Skip to content

Instantly share code, notes, and snippets.

@aslakhellesoy
aslakhellesoy / Makefile
Created December 20, 2011 09:43
Fetch NPM modules with Make
node_modules: Makefile
@rm -rf $@
@mkdir -p $@
$(call get_src_module,$@,https://github.com/tastapod/node-imap/tarball/bruno-merge)
$(call get_npm_module,$@,log,1.2.0)
$(call get_npm_module,$@,connect,1.8.2)
# We have to manually fetch connect's dependencies
$(call get_npm_module,$@,qs,0.4.0)
$(call get_npm_module,$@,mime,1.2.4)
$(call get_npm_module,$@,formidable,1.0.8)

Proposal for fixing IRC for the skype era

IRC IV - A New Hope

IRC as it is sucks. It has many many protocol level failures that more modern chat implementations fix in ways better than modern IRC daemons do.

This proposal is an idea on how to fix all this.

@aslakhellesoy
aslakhellesoy / Makefile
Created December 22, 2011 13:22
Publish NPM packages with Make
NAME := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name)")
VERSION := $(shell node -e "console.log(JSON.parse(require('fs').readFileSync('package.json', 'utf8')).version)")
TARBALL := $(NAME)-$(VERSION).tgz
npm-publish:
@rm -Rf package
@mkdir package
@cp -R lib package/lib
@cp package.json package
@tar czf $(TARBALL) package
@koelling
koelling / gist:ef9b2b9d0be6d6dbab63
Last active February 7, 2017 16:21
CVE-2015-0235 (GHOST) test code
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define CANARY "in_the_coal_mine"
struct {
char buffer[1024];
@sgur
sgur / _vsvimrc
Created September 6, 2013 09:19
_vsvimrc
" indent
set vsvim_useeditordefaults
" Options
set backspace=start
set clipboard=unnamed
set ignorecase
set incsearch
set hlsearch
set visualbell
@saagarjha
saagarjha / xkcdSlackBot.gs
Last active April 11, 2018 06:31
Google Apps Script to post new xkcd comics to a Slack channel
function postUpdatedxkcdIfNecessary() {
var properties = PropertiesService.getUserProperties();
var latestComic = JSON.parse(UrlFetchApp.fetch("http://xkcd.com/info.0.json").getContentText());
if (latestComic["num"] > properties.getProperty("lastComic")) {
var title = latestComic["title"];
var imageURL = latestComic["img"];
var altText = latestComic["alt"];
var number = latestComic["num"];
@jwmerrill
jwmerrill / gbm.jl
Last active June 29, 2018 04:49
Faster geometric brownian motion
function genS_jl(I)
s0 = 600.0
r = 0.02
sigma = 2.0
T = 1.0
M = 100
dt = T/M
a = (r - 0.5*sigma^2)*dt
b = sigma*sqrt(dt)
@lakshminarayanan
lakshminarayanan / development.rb
Created October 4, 2012 07:45
Disable colors in rails console
# disappear the annoying ANSI codes for PowerShell and cmd
if RUBY_PLATFORM =~ /mswin|mingw/i
ActiveSupport::LogSubscriber.colorize_logging = false
end
@alganet
alganet / serve.sh
Last active July 17, 2020 05:42
Serve any folder as a web server with $ curl -L http://tinyurl.com/servesh1 | sh
#!/usr/bin/env sh
# serve.sh
# Modular version: https://gist.github.com/alganet/a22a1373dcee7c175d1e
# Expansion on zsh
command -v setopt 2>&1 >/dev/null && setopt SH_WORD_SPLIT
# POSIX on bash
export POSIXLY_CORRECT=1
# Lists files and folders as HTML
@vishvananda
vishvananda / using-openssl-from-python-with-python-cffi.md
Last active September 9, 2020 16:11
Using OpenSSL from Python with python-cffi

Introduction

A few weeks ago I stumbled across a thread on hacker news that referenced the Matasano Cyrpto Challenge. I find myself unable to resist this type of problem so I decided to make an attempt. It teaches you to find vulnerabilities in crypto systems by starting with simple attacks and building up to more complex ones. Early on in the project it has you start breaking ecryption that uses the AES cypher in ECB mode. It specifically asks you not to implement the cypher yourself but to use a known-correct implementation like OpenSSL.

I tend to try to solve programming challenges in python, because the coding goes much more quickly. I checked the pyOpenSSL docs (which I have used before) to determine the call for encryption in ECB mode.