Skip to content

Instantly share code, notes, and snippets.

@jtgi
jtgi / findMax.s
Created January 20, 2014 17:50
find max int in an array.
.pos 0x100
main: irmovl bottom, %esp # initialize stack
irmovl a, %edi # address of the first element of a
irmovl alen, %esi
mrmovl (%esi), %esi # number of elements of a
irmovl $0x1, %eax
subl %eax, %esi # last index in a
# ready to call findmax: a --> edi, last --> esi
call findmax
@jtgi
jtgi / sigtramp.c
Created November 23, 2014 00:07
Implementing signals via trampolining
#include <xeroskernel.h>
/*
* Runs in user space, executing handler then
* returning to previous stack of the process
*/
void sigtramp(void (*handler)(void *), void *ctx_frame, unsigned int old_esp) {
handler(ctx_frame);
syssigreturn(old_esp);
}
brendan greg's incredibleness: http://www.brendangregg.com/Perf/linux_observability_tools.png
vim practice: wget https://raw.githubusercontent.com/jtgi/algs-ds/1e4f2b066f0b0f102a35e8573d9a12b1f0c19e0b/Trees/Bst.java
import java.util.*;
/*
* NORMAL MODE
* challenge 0: motions
* hjkl - move in all directions
* www - move to next word
* bbb - move to prev word,
* eee - move to next word,
* $ - move to end of line
import java.util.*;
/*
* NORMAL MODE
* challenge 0: motions
* hjkl - move in all directions
* www - move to next word
* bbb - move to prev word,
* eee - move to next word,
* $ - move to end of line
set shell=bash
set t_Co=256
syntax on
filetype on
filetype indent on
map ; :
map <C-h> <C-w>h
map <C-j> <C-w>j
@jtgi
jtgi / gist:36a4e31d9fe25ae8dda6
Last active August 29, 2015 14:17
intro to *nix!

Intro to Unix and Vim star wars: telnet towel.blinkenlights.nl

Who am I

  • 4th year comp sci, cmd line noob

Why command line

  • highly productive
  • O(1) vs long time for mouse
  • Sometimes the only way to get something done. (SysAdmin and deployment.)
wow
Coding at the command line with Vim!
====================================
# Why Vim?
- Runs everywhere (your server), bindings in all your IDEs.
- Very effective for most dynamic / scripting languages and others
that operate closely on the command line.
- The genius of modal editing. Normal vs Insert vs Visual vs Visual Blocks
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <arpa/inet.h>
#include "mpi.h"
#include "fgmpi.h"
<Response>
<Say voice="alice" language="es-ES">Su numero PIN de firma electronica es: 3 7 9 4 1 2</Say>
</Response>