Skip to content

Instantly share code, notes, and snippets.

@banthar
banthar / 2psp.sh
Created December 27, 2010 22:09
movie converter
#/bin/bash
filmy=0
udane=0
nieudane=0
pominiete=0
while [ $# -gt 0 ] ; do
if [ ! -f "${1%.???}.psp.mp4" ] ; then
@banthar
banthar / lazy_read.c
Created January 28, 2011 12:24
lazy read
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur
{
enum Type
{
Void;
Primitive(name:String);
Pointer(to:Type);
Function(args:Array<NamedType>,ret:Type);
}
class NamedType
.file "test2.cpp"
.section .text._ZSt3cosf,"axG",@progbits,_ZSt3cosf,comdat
.weak _ZSt3cosf
.type _ZSt3cosf, @function
_ZSt3cosf:
.LFB22:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
movq %rsp, %rbp
.file "test.cpp"
.globl cosine
.bss
.align 32
.type cosine, @object
.size cosine, 67108864
cosine:
.zero 67108864
.globl sine
.align 32
num: 1 2 3 4
val: 1 1 0 0
limit: 5
@banthar
banthar / stack_trace.c
Created November 7, 2011 01:41
stacktrace with libunwind and elfutils
// stack_trace.c
//
// gcc stack_trace.c -ldw -lunwind -g -o stack_trace
#define UNW_LOCAL_ONLY
#include <elfutils/libdwfl.h>
#include <libunwind.h>
#include <stdio.h>
@banthar
banthar / curses_test.c
Created December 5, 2011 00:04
curses demo
#include <stdio.h>
#include <curses.h>
int main(int argc, char*argv[])
{
initscr();
printw("curses - press any key");
getch();
endwin();
@banthar
banthar / aux.c
Created January 30, 2012 17:06
windows forbidden file name
// aux.c
@banthar
banthar / gist:1866512
Created February 19, 2012 23:38
gdb backtrace
gcc -g -lgmp -o rho rho.c
gdb ./rho
run 10
bt