Syscalls

64 bits 32 bits 16 bits 8 bits rax eax ax al rbx ebx bx bl rcx ecx cx cl rdx edx dx dl rsi esi si sil rdi edi di dil rbp ebp bp bpl rsp esp sp spl r8 r8d r8w r8b r9 r9d r9w r9b r10 r10d r10w r10b r11 r11d r11w r11b r12 r12d r12w r12b r13 r13d r13w r13b r14 r14d r14w r14b r15 r15d r15w r15b Links 64-bit syscalls 32-bit syscalls

August 29, 2014  | 

C Programming Cheatsheet

Links Full ncurses manual Apple Secure Coding C Gibberish (Decode C declarations) Some C #define tricks Cannot find stdio.h (or other headers) Install libc6-dev Case insensitive str(n)cpy #include <strings.h> int strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); xmalloc void *xmalloc(size_t size) { void *ptr = malloc(size); if (ptr == NULL) { fprintf(stderr, "%s: Virtual memory exhausted\n", progname); abort(); } return ptr; } xrealloc void *xrealloc(void *ptr, size_t newsize) { ptr = realloc(ptr, newsize); if (ptr == NULL) { fprintf(stderr, "%s: Virtual memory exhausted\n", progname); abort(); } return ptr; } C Operator Precedence Operator - Description - Associativity () - Parentesis - Left-To-Right [] - Brackets . - Object member -> - Object member -- ++ - Postfix increment/decrement -- ++ - Prefix increment/decrement - Right-To-Left - + - Unary plus/minus ! ~ - Logic negation/complement (type) - Cast * - Dereference & - Address sizeof - Get typesize * / % - Multiply/Divide/Modulo - Left-To-Right + - - Addition/Subtraction << >> - Bitwise shift < <= - Relation less/less or equal > >= - Relation more/more or equal == != - Relation (not) equal & - Bitwise AND ^ - Bitwise XOR | - Bitwise OR && - Logical AND || - Logical OR ?: - Ternary - Right-To-Left = - Assignment += -= - Add/Sub assignment *= /= - Mult/Div assignment %= &= - Modulo / Bitwise AND assignment ^= |= - Bitwise (X)OR <<= >>= - BITWISE SHL / SHR ASSIGNMENT

August 28, 2014  | 

Example SSH Config (.ssh/config)

To make it easier to ssh (and enable autocomplete), create a ~/.ssh/config like this: Host * SendEnv LANG LC_* HashKnownHosts yes GSSAPIAuthentication yes PreferredAuthentications publickey,password IdentityFile ~/.ssh/id_rsa ServerAliveInterval 60 Compression yes CompressionLevel 4 Host github Hostname github.com User git and you will always use user git when you ssh to github

August 28, 2014  |  🏷️Ssh

SSH Agent

If you has a rsa-key and don’t want to write in your credentials every time you ssh, you can use ssh-agent instead. Add this to your .bash_profile (or make it a standalone script you execute once at startup) SSHAGENT=$(command -v ssh-agent) SSHAGENTARGS="-s" if ! pgrep -xu $USER ssh-agent &>/dev/null; then if [[ -z "$SSH_AUTH_SOCK" && -x "$SSHAGENT" ]]; then eval "$($SSHAGENT $SSHAGENTARGS)" trap "kill $SSH_AGENT_PID" 0 fi fi Then you add you credentials once by typing ssh-add (which will add ~/.ssh/id_rsa, you can also add others) and write in your password. Now ssh-agent will automatically provide the password for you for the duration of the session. ...

August 28, 2014  |  🏷️Ssh

Sokoban Game

A small game I made in class

Crosh / HTerm

Go to nassh_preferences_editor.html under chrome extensions Change send-encoding from utf-8 to raw

Example of OpenBSD Postfix main.cf

December 30, 2013  |  🏷️Postfix

Jumpman Game

A small game I made in class

PAE error on boot

If you found this page through Google, it would be stupid to follow these instructions to the letter This kernel requires the following features not present on the CPU: pae Unable to boot - please use a kernel appropriate for your CPU. Step 1: Chroot mount /dev/sda2 /mnt for i in dev proc sys; do mount --bind /$i /mnt/$i; done chroot /mnt Step 2: Make initrd cd /boot mkinitrd -c -k 3.2.45 -m ext2 -f ext2 -r /dev/sda2 Step 3: Add to lilo echo >>/etc/lilo.conf <<EOF # Linux bootable partition config begins image = /boot/vmlinuz-generic-3.2.45 initrd = /boot/initrd.gz root = /dev/sda2 label = Slacky-3.2.45-initrd read-only # Linux bootable partition config ends EOF Step 4: Update lilo and reboot lilo exit umount /mnt/{dev,proc,sys,} reboot

Installing Spotify on Linux

These instructions are old and probably don’t work anymore Add spotify-sources to apt-repo echo "deb http://repository.spotify.com stable non-free" >> /etc/apt/sources.list Add key apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59 Fetch updates apt-get update Add this stupid old dependency This might not be needed anymore / on other distros. Just do it if the next step doesn’t work wget snapshot.debian.org/archive/debian/20110406T213352Z/pool/main/o/openssl098/libssl0.9.8_0.9.8o-6_amd64.deb dpkg -i libssl0.9.8_0.9.8o-6_amd64.deb Install spotify apt-get install spotify-client Run spotify! ...