Skip to content

Instantly share code, notes, and snippets.

@drewwells
drewwells / cache.go
Last active Mar 26, 2022
Go benchmark of md5, sha1, sha256
View cache.go
package bench
import (
"crypto/md5"
"crypto/rand"
"crypto/sha1"
"crypto/sha256"
"hash"
"testing"
)
@drewwells
drewwells / mingwget.sh
Last active Sep 29, 2020
Cross compile windows on OS X with mingw
View mingwget.sh
#!/bin/sh
# check_error my_cmd --param ...
check_error() {
$* # we execute everything
if [ $? -ne 0 ]; then
echo "check_error(): erreur avec la commande suivante:"
echo "check_error(): $*"
echo "check_error(): Continuer? o/n"
read a
@drewwells
drewwells / gist:4219907
Created Dec 5, 2012
Webkit+Moz detect device pixel ratio
View gist:4219907
var ratio = window.devicePixelRatio ||
(function(i){
var wmq = window.matchMedia;
while( !window.devicePixelRatio && i > 0 &&
!wmq("(min--moz-device-pixel-ratio:" + i/10 + ")").matches ){
i=i-1;
}
return i/10;
})(30);
@drewwells
drewwells / core.test.js
Created Apr 14, 2011
RequireJS and QUnit sitting in a tree
View core.test.js
//Wait for relevant code bits to load before starting any tests
define(['core.js'], function( core ) {
module("Core Tests");
test("Test core methods", function(){
expect(2);
equals( 1, 1, "A trivial test");
ok( true, "Another trivial test");
});
@drewwells
drewwells / hijackhttps.go
Last active Sep 9, 2018 — forked from Soulou/hijackhttps.go
I was looking to do HTTPS socket hijacking, here is the way to do ! The link between client and server are completely encrpted.Keywords : HTTPS TCP Socket Hijacking Golang
View hijackhttps.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
@drewwells
drewwells / Custom.css
Created Oct 26, 2011 — forked from anonymous/gist:1258555
Solarized Dark Theme (with sidebar and view-source colors) for Google Chrome Dev Tools
View Custom.css
/**********************************************/
/*
/* Solarized Dark Skin by Mark Osborne - 2011
/*
/* Based on IR_Black Skin by Ben Truyman:
/* https://gist.github.com/1245727
/*
/* and Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
@drewwells
drewwells / mtime_file_watcher.py
Created Sep 30, 2015
do not watch the entire gopath
View mtime_file_watcher.py
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@drewwells
drewwells / org.golang.doc.example.plist
Created Mar 26, 2015
Local godoc server for private packages. You will need to build the search index (periodically) to use search functionality.
View org.golang.doc.example.plist
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>GOPATH</key>
<string>{YOUR GOPATH}</string>
<key>GOROOT</key>
@drewwells
drewwells / left.yaml
Created Aug 8, 2017
what's the difference
View left.yaml
apiVersion: v1
data:
bmc.env: |-
REGION=us-phoenix-1
TENANCY_OCID=ocid1.tenancy.oc1..aaaa
USER_OCID=ocid.user.oc1..aaaa
kind: ConfigMap
View delay.js
define([
"../core",
"../queue",
"../effects" // Delay is optional because of this dependency
], function( jQuery ) {
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;