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
@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 / 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 / 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
hildenae@offle:~/kildekode/fixmystreet$ git branch
* catalyst-norwegian-translation
master
hildenae@offle:~/kildekode/fixmystreet$ git remote -v
origin git@github.com:Kagee/fixmystreet.git (fetch)
origin git@github.com: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
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
#! /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
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
manager:~/scripts# cat foreach_host.sh
for hostname in $(cat /etc/hosts | awk '{print $NF}'); do echo "Working on hostname: $hostname"; $1; done;
manager:~/scripts# ./foreach_host.sh 'nc $hostname 4949'
Working on hostname: manager
$hostname: forward host lookup failed: Unknown host
munmap(0xf77a8000, 4096) = 0
stat64("/var/log/apache2/access.log", {st_mode=S_IFREG|0640, st_size=2162990674, ...}) = 0
open("/var/log/apache2/access.log", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0640, st_size=2162990674, ...}) = 0
_llseek(3, 0, [2162990674], SEEK_END) = 0
_llseek(3, 0, [0], SEEK_SET) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
@Kagee
Kagee / gist:2032045
Created March 13, 2012 22:01
summarize_binlog.pl
#!/usr/bin/perl
use strict;
use warnings;
if ($#ARGV < 0 ) {
print "usage: $0 <path> [path...]\n";
exit;
}
my $file = $ARGV[0];
# Check that the path exsists, is a file, and is readable