Skip to content

Instantly share code, notes, and snippets.

@masterzorag
masterzorag / gtk_play
Created March 18, 2015 16:13
A gtk+ GUI (gtkdialog) to play multimedia (mplayer) in a folder-selection from terminals.
#! /bin/bash
### a gtk+ GUI (gtkdialog) to play multimedia (mplayer) in a folder-selection ###
export MAIN_DIALOG='
<vbox>
<frame Player>
<text>
<label>Choose a Directory</label>
</text>
@masterzorag
masterzorag / gtk_search
Created March 18, 2015 16:31
A gtk+ GUI (gtkdialog) to populate a playlist from ARGV[1] to pass to mplayer.
@masterzorag
masterzorag / binary_operators.c
Last active September 30, 2015 10:02
C binary AND, OR operators play with 32bit int
// gcc -o demo main.c -Wall
#include <stdio.h>
typedef unsigned int uint32_t;
/*
ddacacba
&: 00ACACBA
|: DDFFFFFF
@masterzorag
masterzorag / qsort.c
Last active September 30, 2015 10:35
C scanning directory: qsort
/*
http://www.scs.stanford.edu/histar/src/pkg/uclibc/test/stdlib/qsort.c
gcc -o qsort qsort.c -Wall
*/
#include <stdio.h>
#include <dirent.h>
#include <stdlib.h> // /usr/include/stdlib.h:764:13: note: expected ‘__compar_fn_t’ but argument is of type ‘int (*)(const struct dirent **, const struct dirent **)’
#include <unistd.h>
@masterzorag
masterzorag / GO-DSL-AC750
Last active January 5, 2017 21:37
Collected infos
toolchain info from https://github.com/rusxakep/asuswrt-security/raw/master/release/src/router/email-3.1.3/config.log
---------------
PATH: /opt/trendchip/mips-linux-uclibc/usr/bin # (tbs-sdk missing piece)
PATH: /opt/brcm/hndtools-mipsel-uclibc/bin
PATH: /opt/brcm/hndtools-mipsel-linux/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
@masterzorag
masterzorag / urlenc.c
Created December 17, 2015 16:18
C URL encoding
/*
https://gist.githubusercontent.com/sudar/3404970/raw/3f085b750aaa2ff2f49b148827a19915a4857222/url-encode.c
gcc -o test urlenc.c -Wall
./test "[a b]"
%5ba%20b%5d
*/
#include <stdio.h>
@masterzorag
masterzorag / draw_png_scale2x.c
Last active December 18, 2015 21:12
C simple scale 2X, pixelate
/* gcc -o demo draw_png_2x.c
# ./demo 8
0000 00
0000 01
1000 02
0000 03
00000000000000000000000000000000 00
00000000000000000000000000000000 01
00000000000000000000000000000000 02
[root@fedora-24 SEM_001-ok]# hexdump -C hd.bin | head -4
00000000 c3 68 f3 d9 1c 6b 6f 05 20 9a 3f 94 ca 55 c0 e3 |.h...ko. .?..U..|
00000010 df 37 5d 80 63 0d 85 ad e4 ef 50 54 fe 2a f6 6b |.7].c.....PT.*.k|
00000020 8a 90 1b 80 10 e7 cd 7a c9 39 73 e3 6b ec a4 56 |.......z.9s.k..V|
00000030 93 3e c8 ab 86 17 a8 39 a9 ba bc 50 11 e1 1b f5 |.>.....9...P....|
[root@fedora-24 SEM_001-ok]# hexdump -C hd_3g.bin | head -4
00000000 c3 68 f3 d9 1c 6b 6f 05 20 9a 3f 94 ca 55 c0 e3 |.h...ko. .?..U..|
00000010 df 37 5d 80 63 0d 85 ad e4 ef 50 54 fe 2a f6 6b |.7].c.....PT.*.k|
00000020 8a 90 1b 80 10 e7 cd 7a c9 39 73 e3 6b ec a4 56 |.......z.9s.k..V|
00000030 31 87 52 81 83 a8 70 d1 5f b8 54 36 1b ff 9e a0 |1.R...p._.T6....|
[root@g5 ~]# nvram --partitions
# Sig Chk Len Name
0 5a 82 0002 nvram
1 5f 45 003e system
2 70 bd 00c1 common
3 a0 1e 0052 APL,MacOS75
4 7f c6 00ad wwwwwwwwwwww
[root@g5 ~]# nvram --dump nvram
0x00000000 5a820002 6e767261 6d000000 00000000 |Z...nvram.......|
@masterzorag
masterzorag / FTPS4.elf_issue.log
Created September 5, 2017 14:01
FTPS4.elf issue
ps4sh> execuser ps4ftp.elf
log: [HOST][DEBUG]: [PS4SH] argc=1 argv=host0:ps4ftp.elf
log: [PS4][DEBUG]: [PS4LINK] commands listener received packet size (266)
log: [HOST][DEBUG]: [PS4SH] Opening ps4ftp.elf flags 0
log: [HOST][DEBUG]: [PS4SH] Open return 7
log: [PS4][DEBUG]: [PS4LINK] Received command execuserelf argc=1 argv=host0:ps4ftp.elf
log: [PS4][DEBUG]: [PS4LINK] file open req (host0:ps4ftp.elf, 0 0)
log: [PS4][DEBUG]: [PS4LINK] file open reply received (ret 7)
log: [HOST][DEBUG]: [PS4SH] 53024 result of lseek 0 offset 2 whence
log: [PS4][DEBUG]: [PS4LINK] file lseek req (fd: 7)