Skip to content

Instantly share code, notes, and snippets.

View wilson's full-sized avatar

Wilson Bilkovich wilson

View GitHub Profile

Tools

  • Cabal
    • Starting a new project
    • Sandboxes
      • Creating
      • Deleting
    • Adding dependencies
    • Installing dependencies
    • Adding one or more test suites
@wilson
wilson / .vimperatorrc
Created November 15, 2010 04:33
Download the current youtube page in the background
" This gets added to your vimperatorrc; makes ':yt' trigger youtube-dl
" You can also bind it directly to a keystroke.
" Requires youtube-dl: https://github.com/rg3/youtube-dl
" On a Mac with Homebrew installed, you can 'brew install youtube-dl'
comm! yt 'exe "!" + eval("plugins.youtubeDownload.youtubeDownload()")'
@davidcoallier
davidcoallier / happybirthdayadatask.adb
Created October 7, 2011 14:58
Happy Birthday Ada Lovelace
--
-- Is there a better way to celebrate ones birthday than
-- generating an Ascii cake and some text-output wishin
-- happy birthday to the person I consider one of the most
-- important person in the history of automated computation.
--
-- Note:
-- Compile with gcc after having installed GNAT (If on OSX)
-- $> gcc -c happybirthdayadatask.adb
-- $> gnatbl -o happybirthday happybirthdayadatask.ali
CPPFLAGS += -D_BSD_SOURCE -D_XOPEN_SOURCE=600 \
-I/usr/local/include -Isrc
CXXFLAGS += -std=c++98 -fno-rtti -fno-exceptions -pipe \
-Wall -Wextra -Werror -Wcast-align -Wstrict-overflow -Wshadow
LDFLAGS += -L/usr/local/lib
INSTALL ?= install
ifdef pkg_config_libs
CPPFLAGS += $(shell pkg-config --cflags $(pkg_config_libs))
@ThisIsMissEm
ThisIsMissEm / handler.js
Created November 25, 2014 18:53
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
@cincodenada
cincodenada / logsb
Created November 2, 2013 01:39
A quick alias in irssi to save the scrollback log to a file. I recently turned on logging (/set autolog ON), and wanted to save what scrollback I'd kept as well. After some reading up, this should add the /logsb command, which stores logs for the current channel in the same place as the default logging, in files tagged .scrollback.log. The alias…
/alias logsb lastlog -file ~/irclogs/${tag}/${C}.${F}_${Z}.scrollback.log
@rygorous
rygorous / gist:e0f055bfb74e3d5f0af20690759de5a7
Created May 8, 2016 06:54
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
@cryptix
cryptix / vineScrape.go
Created August 27, 2014 12:31
extract a javascript object value from a html page using goquery and otto
package main
import (
"errors"
"log"
"os"
"github.com/PuerkitoBio/goquery"
"github.com/robertkrimen/otto"
)
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@jboner
jboner / latency.txt
Last active April 18, 2024 17:18
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