Don’t be afraid. Don’t waste time. Get ready for the next step; yeah, one foot after the other. Be humble. Wear sunscreen.
All posts by kit
Batch simplifying svg using Inkscape
for n in *.svg; do inkscape --file="$n" --verb=EditSelectAll --verb=SelectionSimplify --verb=FileSave --verb=FileClose; done
via http://www.inkscapeforum.com/viewtopic.php?f=5&t=12156
Recompiling nginx on Fedora to use Google pagespeed
Google Pagespeed is a nice minify module for nginx/apache, but in order to run on nginx it needs to be compiled into nginx from source. Luckily it’s not too hard.
Google’s directions
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
What I did
sudo yum install gcc-c++ pcre-dev pcre-devel zlib-devel make unzip
NPS_VERSION=1.9.32.1
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/
rpm -ivh https://dl.fedoraproject.org/pub/fedora/linux/updates/20/SRPMS/nginx-1.4.7-1.fc20.src.rpm
Edit /root/rpmbuild/SPECS/nginx.spec
Add to the configure command:
--add-module=/root/ngx_pagespeed-release-1.9.32.1-beta/ \
Rebuild and Install
rpmbuild -bb /root/rpmbuild/SPECS/nginx.spec
rpm -Uvh /root/rpmbuild/RPMS/x86_64/nginx-1.4.7-1.fc17.x86_64.rpm
service restart nginx
Adding a simple systemd script
/etc/systemd/system/your-new.service:
[Unit]
Description=Your cool new service
[Service]
WorkingDirectory=/where/your/service/lives
ExecStart=/where/your/service/lives/bin/daemon
[Install]
WantedBy=multi-user.target
Setting up new computer notes
I have a i3 config repo on github:
git clone https://github.com/kitwestneat/i3-config.git .i3
setup autostart (not sure if this is necessary)
ln -s ~/.i3/i3.desktop .config/autostart/
pidgin w/ gtalk custom domain:
domain: custom.com
connect server: talk.google.com
clipit is the new parcelite
Xdefaults file
Reload with xrdb ~/.Xdefaults
!URxvt*font: xft:Anonymous Pro:bold:size=10
!urxvt.background: black
urxvt.foreground: white
URxvt*depth: 32
URxvt*background: rgba:0000/0000/0000/dddd
!black
URxvt*color0: #171717
URxvt*color8: #737373
!red
URxvt*color1: #FF5E5E
URxvt*color9: #FF7878
!green
URxvt*color2: #9CE82B
URxvt*color10: #9ACD32
!yellow
URxvt*color3: #F0E68C
URxvt*color11: #EEE8AA
!blue
URxvt*color4: #008AFF
URxvt*color12: #4F98FF
!magenta
URxvt*color5: #E88CFF
URxvt*color13: #EDA6FF
!cyan
URxvt*color6: #87CEFA
URxvt*color14: #B0E2FF
!white
URxvt*color7: #DCDCCC
URxvt*color15: #FFFFFF
URxvt.perl-ext-common: ...,font-size,...
URxvt.keysym.C-Up: perl:font-size:increase
URxvt.keysym.C-Down: perl:font-size:decrease
URxvt.keysym.C-S-Up: perl:font-size:incglobal
URxvt.keysym.C-S-Down: perl:font-size:decglobal
URxvt.iso14755: false
URxvt.iso14755_52: false
Varnish cache idea
http://kly.no/posts/2012_06_19_Cache_Popular_Content_Longer.html
Self-Signing Modules on Fedora 20
I recently got a new computer for work. So new that the wireless drivers are not yet included in the kernel mainline, though they do exist in the staging tree in the main branch. It’s relatively easy to compile the module following the directions post on this blog post:
http://www.linlap.com/asus_transformer_book_trio_tx201la
Updated kernel source for 3.15:
https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git/+archive/v3.15/drivers/staging/rtl8821ae.tar.gz
Makefile append:
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) CONFIG_R8821AE=m modules
Basically you download that tarball, append to the Makefile, and run make. Simple.
The problem I ran into is that UEFI SecureBoot is set up, meaning that all code inserted in the kernel needs to be signed and recognized by the bios. It’s really not obvious how to do this, I guess because people are not really encouraged to build custom modules and kernels. I did eventually find a post from the SystemTap guy on how to do it:
http://sourceware.org/systemtap/wiki/SecureBoot
x509.genkey openssl config file
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts
[ req_distinguished_name ]
CN = Modules
[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
Creating the x509 certs, and adding them to MoK (machine-owner keys):
openssl req -new -nodes -utf8 -sha256 -days 36500 -batch -x509 -config x509.genkey -outform DER -out signing_key.x509 -keyout signing_key.priv
sudo mokutil --import signing_key.x509
reboot
Sign modules and install:
/usr/src/kernels/`uname -r`/scripts/sign-file sha512 signing_key.priv signing_key.x509 rtl8821ae.ko
sudo cp rtl8821ae.ko /lib/modules/3.16.0-1.fc22.x86_64/kernel/drivers/staging/rtl8821ae/
It kernel panic’d the first time (oops). The second time it ran ok.
Fuxing with video: Replace audio, add watermark
# cut the video to match the time of the audio
ffmpeg -i input.mp4 -ss 0 -t
# replace the audio
ffmpeg -i input.mp4 -i input.mp3 -map 0:0 -map 1 -vcodec copy -acodec copy output.mp4
# adding an overlay to the video, replace the 0:0 with x:y coords
ffmpeg -y -i input.mp4 -i image.png -filter_complex 'overlay=0:0' -strict -2 output.mp4
Rotoscoping with autotrace and inkscape
From http://kansenzone.blogspot.com/2008/05/automatic-rotoscoping.html
autotrace file.jpg -output-format svg -color-count 10 -despeckle-level 20 -filter-iterations 10 > file.svg