UNIX Diary - Psychology, Philosophy, and Licenses
venam
Dear Unix Diary,
I had some problems with vim.
I'm using the basic terminal vim (not graphic vim) and I wanted to copy some text.
I have a plugin for urxvt that binds some keys so I can copy text when selecting
it with the mouse. In this case the key is "ALT" plus "C" to copy or "V" to paste.
I remembered setting the same thing in vim so I tried to go in visual mode and
entered the key combination. Nothing happened. I repeated that x times until I
finally noticed that I was doing something wrong.
I checked the pacman logs and saw that vim had been updated some days ago.
I thought ok, maybe the configs changed.
The configs opened in front of me (related part):
Code:
map &lt;leader>cc :w !xsel -i -b<CR>
map &lt;leader>cp :w !xsel -i -p<CR>
map &lt;leader>cs :w !xsel -i -s<CR>
" Paste from X CLIPBOARD
map &lt;leader>pp :r!xsel -p<CR>
map &lt;leader>ps :r!xsel -s<CR>
map &lt;leader>pb :r!xsel -b<CR>
I thought "Yeah, it seems like it's supposed to work". I retried the keys in the
hope that it would magically work but it didn't.
After browsing the web for around 1h and testing things in the configs I ultimately
found the solution.
I forgot that I had set the leader key to ',' and not 'alt'.
Code:
let mapleader=","
Oh, Arch you are building up some habits in me that I shouldn't have in the first place.
Thanks a lot for that.
Lesson of the story, don't get messed up with different keybinds for different
programs but that do the same action.
vompatti
Dear Unix Diary,

Today I decided that it's time to try ATI's closed source drivers on my laptop with Arch Linux. Since I have old HD 3650 GPU, I had to use old version of catalyst drivers and they required old version of xorg (1.12). After I rolled back my xorg and installed catalyst drivers, xorg didn't even launch. Then I noticed that the drivers were build with 3.12 kernel (which is lts) so I went and installed it from AUR. After that, xorg didnt work and then I remembered that with catalyst, you had to run aticonfig --init to generate the xorg.conf file. Now everything seems to run like it should, just some preformence testing needed. I'll try install the 3.16 kernel tomorrow and see if catalyst dirvers plays nice with it.

EDIT: P.S. back to open source drivers and 3.16 kernel we go...
z3bra
Dear Unix Diary,

Today, I found a way to upgrade all my git ports at the same time.

Here I am, in ~/usr/ports, starring at all those -git ports that have changed a lot while I was on holidays.
I realise that I have to update the "$sversion" of each of these packages by hand to the latest commit, then update the version, build the package and see if it compiles well... I'm already tired of doing so...

As the lazy programmer as I am, I instantly think: "I'll write something to do it for me !". And there I go. `prtup` is alive ! It allows me to update the "Pkgfile" of a CRUX port to the latest git commit. I can see the end of the tunnel...

Now, how to check if the latest commit still compiles ? My fingers are dancing on the keyboard, each of them knowing exactly where to type:

Code:
for DIR in *-git;
do
    cd $DIR
    prtup
    fakeroot pkgmk -if || echo $DIR >> ../failed.txt
    cd ..
done

Now the screen vomits characters... Output of git pull, prtup, pkgmk, ... all those programs are updating and compiling under my eyes.
It's finished. I'm affraid while I'm typing:

Code:
─── cat ~/usr/ports/failed.txt
cat: /home/z3bra/usr/ports/failed.txt: No such file or directory

Victory ! Everything is now up to date !

I then had to push the changes to publish them.
DotDev
Dear Unix Diary,

I have finally achieved what i want to do with my system, and started re-learning how to code in python. I hopefully will be able to contribute to the forum by helping with projects, tutorials, etc.

P.S. {Rainbow Prompt ZSH}
http://blog.fujimuradaisuke.com/post/107...mpt-in-zsh < like the prompt i used for My Current Setup

^ Thought I'd contribute to the nix society
shtols
Dear Unix Diary,

I didn't really accomplish anything practical in the last few days, at least not something that would be worth mentioning in this thread. However I spent a great of time thinking about Darknets, alternative networks, VPN-networks, meshed networks and so on, getting more and more fascinated the more I read about it.

There are too many projects out there to name them all in one post, one of the most fascinating ones being Decentralized network 42, sort of an Internet inside the Internet, with it's own AS numbers and own IPv6 addressspace, routing is done in between the nodes with whatever you like, most people run OpenBGPd, but there are also some people that use full-blown-juniper-devices.

Combinating that with an approach like RetroShare I came of with that being a nice project for myself to be accomplished over time. Sort of build an invitation-only-VPN-network (tinc seems to be software that was designed with that idea in place), with your own domain-name-system, your own certificate authority and so on, enabling private and cryptographically secure communication. You could fileshare over that network, play games, send mails that won't even be seen on the normal Internet on so on.

Dear diarists (I made an abomination out of the word 'barista'), does that sound totally retarded or even remotely interesting?
venam
(21-08-2014, 12:55 PM)shtols Wrote: Dear diarists (I made an abomination out of the word 'barista'), does that sound totally retarded or even remotely interesting?
Indeed, it really is.
The interesting thing about this thread is that you might find what you write boring but it's nice to read what others do.
venam
Dear Unix Diary,
I copied my music from my Arch box to my Debian box.
The way I did it is simple, I linked the music dir from my arch box to
/srv/httpd and made it readable.
I edited my httpd conf to allow faster download because I set the limit to 1MBs
using rate-limit.
Code:
&lt;Location />
    SetOutputFilter RATE_LIMIT
    SetEnv rate-limit 1000
&lt;/Location>
And I started the server:
Code:
sudo systemctl start httpd
sudo systemctl start php-fpm
Now all I had to do was browse and download the music from my other machine.
I have an addon in Firefox called "Flashgot" that lets you download multiple
files using an external download manager like axel or aria2.
This is the fastest way I know to transfers music.
The reason why I am transferring the music to the other laptop is because its
battery last longer and I want to use it as a walk-man when I'm at university.
This also got me started on a new project that I'll call walk-man
z3bra
Dear Unix Diary,

Yesterday, Unix helped me (again) doing my job in an easier and faster way.
At work, we bought a new check in machine, that comes along with RFID cards. We also bought a card printing machine for the occasion.
My job was then to print the logo of the company, with the name, surname and ID of the 84 persons that are going to use these cards. The original approach would have been:
  • Fire up paint to create the template of the card
  • Fill in the info for the first person
  • Export the image
  • Print it on the card
  • Repeat

That's not what Unix taugh me, sorry.
I started vim, and created a small script using some imagemagick binaries (convert + composite) that create the image from 4 parameters: $_login (first letter of the surname + 7 letters from the name) $_name, $_surname and $_id. I then asked the HR departement for a CSV export of the names/surname of the persons I had to create a badge for, and exported a list of the login names + IDs from the checkin software. I now had 2 lists: people.csv (name + surname), and checkin.csv (id + login).

First, I used Vim's macros to create the login of each person in people.csv. Now in the two lists, my first column is the login of each person.
And here comes Unix...
Code:
join <(sort people.csv) <(sort checkin.csv) -t, | sed 's/,,/,/g' > final.csv
Now I have a list with login, name, surname and ID. All I have to do now is to write a wrapper script for my "card-maker" that will read each line of the final.csv and create a card for the person:
Code:
#!/bin/sh
cat final.csv | while IFS=, read _login _name _surname _id; do
    printf "%8s (%d)" $_login $_id
    mkcard $_login $_name $_surname $_id
done

And here I am ! 84 card images created in half an hour, instead of having to edit 84 times the same image in paint, and changing the names by hand.

Thank you, Unix !
venam
Dear Unix Diary,
I got that idea to use my laptop as a walkman.
The goal was to be able to close the lid, listen to music with earphones, and when I remove the earphones the music would stop and the laptop would suspend.
To achieve this I wrote a simple daemon state machine that has commands attached to the transition of one state to another, see it on github http://github.com/venam/Walkman.
Code:
"""
States

(JACK_IN  - LID_OPEN) : (IO)
(JACK_IN  - LID_CLOSE): (IC)
(JACK_OUT - LID_OPEN) : (OO)
(JACK_OUT - LID_CLOSE): (OC)
"""

"""
The commands to be executed when switching from one state to another
"""
STATE_COMMANDS= {
        "OOIO":"",
        "IOOO":"",
        "IOOC":"",
        "OCIO":"",
        "OCIC":"",
        "ICOC":"jack_out_closed_lid.sh",
        "ICOO":"",
        "OOIC":"",
        "IOIC":"",
        "ICIO":"",
        "OOOC":"",
        "OCOO":""
        }

The next step was to be able to stop the music and suspend.
I'm using this script on my Debian box, which uses pm-utils to control the power (suspend, hibernate, etc..). Only root had access to those commands so I edited /etc/sudoers to allow my user to suspend.
Code:
stick ALL = NOPASSWD: /usr/sbin/pm-suspend
That's one thing out of the todo list, now I had to find how to control my music player from the script.
I'm using plain mplayer to play my music and I found that this works really well:
Code:
mkfifo /tmp/mplayer-control;
mplayer -input file=/tmp/mplayer-control yourZikHere
After executing that you can control mplayer like this:
Code:
echo "pause" > /tmp/mplayer-control

Finally, my "jack_out_closed_lid.sh" looks like:
Code:
#!/bin/sh

echo "pause" > /tmp/mplayer-control
amixer set Master mute -q
sudo pm-suspend
xero
dear unix diary,
today was a big day. i installed arch on a mac book air on the first try!

background for peeping toms that may be reading my unix diary, i'm an avid mac hater. i really don't like the form factor of all their proprietary hardware. the terrible, brain numbingly flat colors on white ui of everything. the whole hipster asteic of the "apple brand". that's not what i'm looking for in a computer. i'm looking for something free, something functional, and something that i can configure the way i like.

*ahem*
so i recently got a new job. when i was in their office on the final interview i noticed everyone was using a mac. i told them i was a nixer, and would turn down the job if i was forced to use a mac. the guy told me that they "give out macbook air laptops out to all developers. if i wanted to hack it up and install linux on it, that was fine. as long as i could get the job done." so my first week on the job i used the laptop as a vanilla mac. boy was that a horrible experience. i now have complete reassurance as to why i'm a nixer. so this weekend i installed arch on it.

Code:
cgdisk /dev/sda
#partition
mkfs.ext4 /dev/sda5
mkfs.ext4 /dev/sda6
mount /dev/sda6 /mnt
mkdir /mnt/boot && mount /dev/sda5 /mnt/boot
#usb tethering
sudo dhcpcd
#install
pacstrap /mnt base base-devel
genfstab -U -p /mnt >> /mnt/etc/fstab
#ssd optimize
vim /mnt/etc/fstab
> /dev/sda6 /     ext4 defaults,noatime,discard,data=writeback 0 1
> /dev/sda5 /boot ext4 defaults,relatime,stripe=4              0 2
#setup
arch-chroot /mnt /bin/zsh
passwd
echo nixair > /etc/hostname
ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
hwclock --systohc --utc
useradd -m -g users -G wheel -s /bin/bash xero
passwd xero
pacman -S sudo
echo "xero ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
#language
vim /etc/locale.gen
locale-gen
echo LANG=en_US.UTF8 > /etc/locale.conf
export LANG=en_US.UTF-8
mkinitcpio -p linux
pacman -S grub-efi-x86_64
#boot loader
vim /etc/default/grub
> GRUB_CMDLINE_LINUX_DEFAULT="quiet rootflags=data=writeback libata.force=1:noncq"
> GRUB_DISABLE_SUBMENU=y
grub-mkconfig -o boot/grub/grub.cfg
grub-mkstandalone -o boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
#quit chroot
exit
#reboot
systemctl reboot
#setup wiki
modprobe wl
#install wifi drivers from aur https://aur.archlinux.org/packages/broadcom-wl-dkms/
sudo pacman -S dkms
sudo systemctl enable dkms.service
sudo pacman -S dialog
sudo wifi-menu -o
#fix tilde key
sudo vim /etc/modprobe.d/hid_apple.conf
options hid_apple iso_layout=0

after that it was just a matter of installing x666 packages, syncing my dotfiles, symlinking them into place with gnu stow.

when i was finally finished i sat down on the couch and my wife looked at me a smiled. i asked her what the "smirk" was about, and she reminded me how i installed and configured her mint laptop in 15 minutes. and proclaimed:

"arch - linux for crazy people."




Members  |  Stats  |  Night Mode