Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@ankurs
ankurs / poll.h
Created March 12, 2011 21:19
epoll wrapper
#ifndef _POLL_H
#define _POLL_H
#include "hash_table/hashtable.h"
#include <sys/epoll.h>
#define MAX_EVENTS 100
#define CALLBACK(x) void (*x) (poll_event_t *, poll_event_element_t *, struct epoll_event)
#define ACCEPT_CB 0x01
@branneman
branneman / Struct.php
Created May 2, 2011 09:53
PHP Struct class
<?php
class Struct
{
/**
* Define a new struct object, a blueprint object with only empty properties.
*/
public static function factory()
{
$struct = new self;
foreach (func_get_args() as $value) {
@stran12
stran12 / gist:1394757
Created November 26, 2011 00:43
Step-by-step installation of cGit with Nginx

How to install cGit on Nginx (Ubuntu server)

Step-by-step installtion of cGit on nginx without funky rewrite rules.

Pre-requisites

This is for

@ryan-beckett
ryan-beckett / JInterpreter.java
Created February 4, 2012 07:06
JInterpreterDemo: A demo displaying how the JavaCompiler API can be used to create an application that executes java code given as runtime input from a user. This gist also includes a facade for the JavaCompiler API and a JInterpreter class for interpreti
import java.io.*;
import java.net.*;
import java.util.*;
/**
* A Java statement interpreter. Add a list of statements with
* <code>newStatement</code> and run them with
* <code>run</code>. After running the interpreter, all
* previously added statements are forgotten.
*/
@christianparpart
christianparpart / monkeypatchor.cpp
Created May 24, 2012 18:06
Monkey-Patching in C/C++ :-)
// compile me: g++ -shared -fPIC -ldl -o monkeypatchor.so monkeypatchor.cpp
// use me: LD_PRELOAD=`pwd`/monkeypatchor.so /bin/ls
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
void* (*malloc_super)(size_t);
void (*free_super)(void*);
@rtomaszewski
rtomaszewski / example_paramiko_with_tty.py
Created August 19, 2012 19:49
example paramiko script with interactive terminal
import paramiko
import time
import re
bastion_ip='ip'
bastion_pass='pass'
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
ssh.connect(bastion_ip, username='root', password=bastion_pass)
@lsauer
lsauer / fuzzy-search.sql
Last active December 7, 2023 23:58
FullText fuzzy searching in SQL / MySQL
#lo sauer, 2013 - www.lsauer.com
#see: http://www.lsauer.com/2013/05/mysql-fuzzy-searching-fulltext-queries.html
#Note: In MySQL SUBSTRING, the string-index starts at position 1
SELECT * FROM tablename
WHERE SOUNDEX(tablename_field)
LIKE CONCAT('%',SUBSTRING(SOUNDEX('Fuzti serch derm'),2),'%');
@livibetter
livibetter / README.md
Last active June 25, 2018 05:00
Listing new trending repos on GitHub
@pbojinov
pbojinov / README.md
Last active June 27, 2025 05:25
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@sh1n0b1
sh1n0b1 / ssltest.py
Created April 8, 2014 07:53
Python Heartbleed (CVE-2014-0160) Proof of Concept
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select