Skip to content

Instantly share code, notes, and snippets.

@DeanThompson
DeanThompson / ecb.go
Last active February 12, 2023 05:10
Golang AES ecb mode
package utils
import "crypto/cipher"
type ecb struct {
b cipher.Block
blockSize int
}
func newECB(b cipher.Block) *ecb {
@eddmann
eddmann / SecureSessionHandler.php
Created April 9, 2014 12:18
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@pixline
pixline / Makefile
Last active December 15, 2015 15:56
Vagrant project setup Makefile
# Digital Ocean Vagrant Makefile
# Based on https://gist.github.com/avalanche123/1297080
# These values are overwriteable by command line.
AUTHOR = SWERgroup Developers <[email protected]>
PROJECT = vagrant
CONFDIR = config
PROVDIR = provision
define license
package.preload['moonscript.transform.names'] = function()
local build
do
local _table_0 = require("moonscript.types")
build = _table_0.build
end
local unpack
do
local _table_0 = require("moonscript.util")
unpack = _table_0.unpack
@lisamelton
lisamelton / convert-mp4-to-mkv.sh
Last active May 24, 2024 17:41
Convert MP4 video file into Matroska format without transcoding.
#!/bin/bash
#
# convert-video.sh
#
# Copyright (c) 2013-2014 Don Melton
#
about() {
cat <<EOF
$program 2.0 of December 3, 2014
@dmitshur
dmitshur / gist:6927554
Last active December 29, 2024 12:06
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.
@flc
flc / image.go
Created September 4, 2013 14:17
A Tour of Go - Exercise: Images http://tour.golang.org/#60
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{
@willurd
willurd / web-servers.md
Last active September 1, 2025 05:45
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@benbjohnson
benbjohnson / README.md
Last active February 11, 2019 12:10
LuaJIT + Go Integration Test

Create an empty directory, download the code and run it:

$ mkdir /tmp/lj
$ cd /tmp/lj
$ wget https://gist.github.com/benbjohnson/5622779/raw/e53d227ebdbea8d513b62ad076feb3f6ac1c1594/luajit.go
$ go run luajit.go

And you should see:

@citrin
citrin / range2cidr.c
Created December 4, 2012 11:28
Convert IPv4 range to list of CIDR prefixes
#include <arpa/inet.h>
#include <assert.h>
#include <err.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#define IPv4_BITS 32