Skip to content

Instantly share code, notes, and snippets.

View aeurielesn's full-sized avatar

Alexander Urieles aeurielesn

View GitHub Profile
@klynch
klynch / android-configure.sh
Created December 31, 2013 04:42
This script runs a configure script with the Android NDK toolchain You may need to adjust the COMPILE_TARGET and ANDROID_API variables depending on your requirements.
#!/bin/sh
# This script runs a configure script with the Android NDK toolchain
# You may need to adjust the COMPILE_TARGET and ANDROID_API variables
# depending on your requirements.
#
# Call this script in a directory with a valid configure script.
# Example: PREFIX=${PWD}/bin android-configure.sh
# Set the ANDROID_NDK variable to the root
@preshing
preshing / sort1mb.cpp
Created October 25, 2012 11:28
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@alotaiba
alotaiba / google_text2speech.md
Created February 3, 2012 07:31
Google Text to Speech API

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English

@gooh
gooh / xpath_match_all
Last active September 28, 2015 00:48
function for people whining that preg_match_all is less to type and concluding from it that regex must be better for parsing html than a dom parser
<?php
/**
* Run an XPath query against an HTML string and returns the results
*
* @param string $xpath The XPath query to run on $thml
* @param string $html The HTML to parse. Uses the previously used string if omitted
* @return array
*/
function xpath_match_all($query, $html = '')
{
@zaius
zaius / background.sh
Created January 16, 2011 23:29
How to redirect a running process output to a file and log out
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)
@isaacs
isaacs / callbacksarehard.js
Created January 12, 2011 02:29
let's go shopping!
// before
mainWindow.menu("File", function(err, file) {
if(err) throw err;
file.openMenu(function(err, menu) {
if(err) throw err;
menu.item("Open", function(err, item) {
if(err) throw err;
item.click(function(err) {
if(err) throw err;
mainWindow.getChild(type('Window'), function(err, dialog) {