Skip to content

Instantly share code, notes, and snippets.

@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@jlongster
jlongster / gist:1840230
Created February 16, 2012 00:03
tracing Outlet code
(trace-source (let ((i (+ 4 5)))
(+ i (* 2 (/ 3 4)))))
;; Output
(let ((i (+ 4 5)))
(+ i (* 2 (/ 3 4))))
-- (+ 4 5)
>> RESULT: 9
@jlongster
jlongster / gist:1712455
Created January 31, 2012 19:37
traditional lisp macros
;; outlet code for implementing traditional macro expansion
;; macros
(define (expand form)
(cond
((variable? form) form)
((literal? form) form)
((macro? (car form))
(expand ((macro-function (car form)) form)))
@vwood
vwood / compact-search-engine.py
Created December 9, 2011 05:02
Short Python3 Search Engine
#!/usr/bin/env python
# Short indexer and search engine, 2011 Vaughn Wood
# Written in python 3
# Assumes the collection is a newline separated file called index on the current path
# Only uses TF (so perform queries accordingly)
from functools import *
def dict_join_add_values(d, e):
"""Given two dictionaries, add the items in the second to the first.
@vwood
vwood / channel.c
Created November 17, 2010 03:33 — forked from vwood/channel.c
Channels with asynchronous support.
#include <semaphore.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "channel.h"
struct channel_s {
sem_t empty_semaphore;
sem_t fill_semaphore;
@vwood
vwood / ecldemo.c
Created November 4, 2010 03:49
Example of ECL in a C program.
/*
Example of a C program embedding ECL with callbacks to C functions.
Compiled via: gcc ecldemo.c -lecl
*/
#include <stdio.h>
#include <stdlib.h>
#include "ecl/ecl.h"
#define DEFUN(name,fun,args) \
cl_def_c_function(c_string_to_object(name), \