Skip to content

Instantly share code, notes, and snippets.

@drewwells
drewwells / Custom.css
Created October 26, 2011 19:30 — forked from anonymous/gist:1258555
Solarized Dark Theme (with sidebar and view-source colors) for Google Chrome Dev Tools
/**********************************************/
/*
/* 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 / cache.go
Last active June 22, 2023 20:39
Go benchmark of md5, sha1, sha256
package bench
import (
"crypto/md5"
"crypto/rand"
"crypto/sha1"
"crypto/sha256"
"hash"
"testing"
)
aws_creds() {
local profile="${1:-${AWS_PROFILE}}"
local account_id="$(aws configure get sso_account_id --profile "${profile}")" \
role_name="$(aws configure get sso_role_name --profile "${profile}")" \
region="$(aws configure get region --profile "${profile}")" \
start_url="$(aws configure get sso_start_url --profile "${profile}")"
if [ -z "$start_url" ] ; then
echo "did not find sso_start_url in profile ${profile}"
exit 1
@drewwells
drewwells / mingwget.sh
Last active September 29, 2020 23:22
Cross compile windows on OS X with mingw
#!/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 December 5, 2012 22:02
Webkit+Moz detect device pixel ratio
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 April 14, 2011 20:21
RequireJS and QUnit sitting in a tree
//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 September 9, 2018 01:25 — 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
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
@drewwells
drewwells / mtime_file_watcher.py
Created September 30, 2015 06:34
do not watch the entire gopath
#!/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 March 26, 2015 16:07
Local godoc server for private packages. You will need to build the search index (periodically) to use search functionality.
?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 August 8, 2017 18:29
what's the difference
apiVersion: v1
data:
bmc.env: |-
REGION=us-phoenix-1
TENANCY_OCID=ocid1.tenancy.oc1..aaaa
USER_OCID=ocid.user.oc1..aaaa
kind: ConfigMap