Skip to content

Instantly share code, notes, and snippets.

View adamvr's full-sized avatar

Adam Rudd adamvr

  • Cologne, Germany
View GitHub Profile
Solution:
Launch Keychain Access by clicking Applications > Utilities > Keychain Access
On the left upper pane, under Keychains select System
On the left lower, under Category select All Items
On the right side of the screen scroll to the bottom and locate the two items called VPN(IPSec)
Double-click the VPN(IPSec) whos kind is IPSec XAuth Password
Click the Access Control button/tab. The applications permitted to use this keychain item will be displayed below. If you’re prompted for your password, enter it.
Click the plus (+) sign
When the Finder window appears, press Cmd + Shift + G on your keyboard
When the Go To Folder dialog appears, enter /usr/libexec
@adamvr
adamvr / Making m3u for playing files over http
Created December 16, 2010 22:57
A bash one liner for generated m3u playlists that are can include any files on the file server, rather than just in a local directory
$ ls ./maus/music/Stevie\ Ray\ Vaughn\ and\ Double\ Trouble/Texas\ Flood/*.mp3
| sed 's/^\./http:\/\/red.act.ed/'
| sed 's/ /%20/g'
> playlist.m3u
Which produces a file of the form:
$ cat playlist.m3u
http://red.act.ted/maus/music/Stevie%20Ray%20Vaughn%20and%20Double%20Trouble/Texas%20Flood/01%20Love%20Struck%20Baby.mp3
What about JSON bindings for XMPP?
@adamvr
adamvr / Script for setting id3v2 tags for a certain form of filename
Created December 21, 2010 21:59
Sets the id3v2 tags for all the files mp3 files in the current directory. Expects files of the form "x - y - dd.mp3"
for i in *.mp3
do
num=`echo "$i" | awk -F ' - ' '{print substr($3,1,2)}'`
max=`echo "$i" | awk -F ' - ' '/END/ {print end} {end = substr($3,1,2)}'
id3v2 -a "artist" -A "album" -t "artist - album - track $num" -T "$num/$end"
done
@adamvr
adamvr / mosquitto_skeleton.py
Created December 22, 2010 04:18
Skeleton code for libmosquitto-py
import mosquitto
def on_connect(rc):
if rc == 0:
print "Connected"
def on_message(msg):
# Do something
print msg.topic
print msg.payload
import Image
import StringIO
buffer = file("xyz.jpg").read()
si = StringIO.StringIO(buffer)
i = Image.open(si)
i.show()
Extracting *.tar.gz using tar:
tar -xzvf file.tar.gz
@adamvr
adamvr / sed to comment out lines of source code
Created January 6, 2011 23:06
A sed script to insert a comment character or characters to the beginning of a matched line. Source = http://scotgate.org/2006/02/27/useful-sed-line/
sed 's|.*LINE_TO_MATCH.*|//&|g' fileToComment.h
# All ports
sudo lsof -i -P
# Listening ports
sudo lsof -i -P | grep "LISTEN"
@adamvr
adamvr / mosquitto-cmake-man-and-python-patch.patch
Created January 18, 2011 02:33
This patch modifies the cmakelists of mosquitto-0.9.1 to facilitate the installation of mosquitto's man pages and python module using cmake.
# Corrects brace types in lib/CMakeLists.txt
# Adds python module installation
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 915fcac..957c2e5 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,4 +1,5 @@
add_subdirectory(cpp)
+add_subdirectory(python)