Skip to content

Instantly share code, notes, and snippets.

View Kagee's full-sized avatar
👾
Still working from home, what about you?

Anders Einar Hilden Kagee

👾
Still working from home, what about you?
View GitHub Profile
manager:~/scripts# HEAD localhost
200 OK
Connection: close
Date: Fri, 03 Feb 2012 10:53:18 GMT
Accept-Ranges: bytes
ETag: "291e2-2d-4b780e0db2dc0"
Server: Apache/2.2.9 (Debian)
Vary: Accept-Encoding
Content-Length: 45
Content-Type: text/html
#! /bin/bash
if [ -f $1 ]
then
vim $1;
else
touch "$1"
chmod +x "$1"
echo -e "#! /usr/bin/perl\nuse strict;\n\n" > "$1";
vim "$1"
fi
cd ~
cd .weechat
mkdir python
mkdir python/autoload
wget http://www.weechat.org/files/scripts/weeget.py
1. is now complete:
http://weechat.org/files/doc/stable/weechat_quickstart.en.html#plugins_scripts
hildenae@offle:~/kildekode/fixmystreet$ git branch
* catalyst-norwegian-translation
master
hildenae@offle:~/kildekode/fixmystreet$ git remote -v
origin [email protected]:Kagee/fixmystreet.git (fetch)
origin [email protected]:Kagee/fixmystreet.git (push)
upstream https://github.com/petterreinholdtsen/fixmystreet.git (fetch)
upstream https://github.com/petterreinholdtsen/fixmystreet.git (push)
hildenae@offle:~/kildekode/fixmystreet$ git rebase upstream/catalyst-norwegian-transla
tion
@Kagee
Kagee / swfdump_Laplace_Del_3.swf.log
Created November 16, 2011 10:59
Example of dump from swfdump
[HEADER] File version: 8
[HEADER] File is zlib compressed. Ratio: 91%
[HEADER] File size: 25179792
[HEADER] Frame rate: 24.000000
[HEADER] Frame count: 23
[HEADER] Movie width: 960.00
[HEADER] Movie height: 628.00
[045] 4 FILEATTRIBUTES
[009] 3 SETBACKGROUNDCOLOR (00/00/00)
[002] 100 DEFINESHAPE defines id 0003
@Kagee
Kagee / extract.sh
Created November 16, 2011 08:21
Extracting MP3 sound from SWF notes
#! /bin/bash
echo Extracting from $1;
bname=$(basename $1 .swf);
data=$(swfdump "$1" | grep MP3)
echo "$data"
# Remove double spaces and take value in field 7 separated by spaces
ids=$(echo "$data" | sed 's, , ,g' |cut -d " " -f 7)
Counter=1 # Counter 1..2..3..4..N
CounterWoError=0
# Loop through all id's
@Kagee
Kagee / gist:1369504
Created November 16, 2011 07:32
Extracting MP3 sound from SWF notes
hildenae@sektober:~/Dropbox/HiG/Matte 20/SWF$ swfdump Laplace_del_1.swf | grep MP3
[00e] 3432500 DEFINESOUND defines id 0536 (MP3 44Khz 16Bit mono)
[00e] 1791488 DEFINESOUND defines id 0546 (MP3 44Khz 16Bit mono)
[00e] 1532562 DEFINESOUND defines id 0562 (MP3 44Khz 16Bit mono)
[00e] 1858570 DEFINESOUND defines id 0575 (MP3 44Khz 16Bit mono)
[00e] 2048219 DEFINESOUND defines id 0582 (MP3 44Khz 16Bit mono)
[00e] 2364196 DEFINESOUND defines id 0589 (MP3 44Khz 16Bit mono)
[00e] 1895873 DEFINESOUND defines id 0596 (MP3 44Khz 16Bit mono)
hildenae@sektober:~/Dropbox/HiG/Matte 20/SWF$ swfextract -s 0562 Laplace_del_1.swf && mv output.mp3 Laplace_del_1_03.mp3
hildenae@sektober:~/Dropbox/HiG/Matte 20/SWF$ swfextract -s 0575 Laplace_del_1.swf && mv output.mp3 Laplace_del_1_04.mp3
@Kagee
Kagee / tweet.sh
Created November 2, 2011 16:10
cli-tweet - last-name-tweet + tweet_id
#!/bin/bash
# wget $? == 8 == server error response
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
# It's a string (user)
tweetXML=$(wget -q -O - "http://api.twitter.com/1/statuses/user_timeline/"$1".xml?trim_user=true&count=1&include_rts=true")
wgetRC=$?
if [ "$wgetRC" -eq "8" ]; then
echo "Brukeren finnes ikke"; exit 1;
fi
/*
1. The input documents somtimes has characters that are not valid as UTF-8 text. Where/how can i filter/remove them ?
hildenae@sektober:~/Dokumenter/Kildekode/statsparser$ java dom
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(XMLEntityScanner.java:1416)
public class ReplacingInputStream extends FilterInputStream
public ReplacingInputStream(InputStream in) {
super(in);
this.in = in;
}
public int read() throws IOException {
int read = super.read();
if (read!=-1 && read<0x20 && !(read==0x9 || read==0xA || read==0xB))
{ read = 0x20;}
return read;