Skip to content

Instantly share code, notes, and snippets.

View base698's full-sized avatar

Justin Thomas base698

View GitHub Profile
@base698
base698 / notion-insert.py
Last active March 25, 2023 17:34
Insert your tunnel log into notion database for your own skills page!
from pprint import pprint
import os
import sys
import json
from datetime import datetime
from notion_client import Client
# Replace with your API key
NOTION_API_KEY = os.environ.get("NOTION_API_KEY")
pragma solidity ^0.4.10;
contract Stock {
mapping (address => shares) stockHolders;
uint numShares;
function Stock() {
numShares = 100;
}
@base698
base698 / chord.html
Last active February 17, 2017 16:46
Sample chord diagram. Look at L235 to change the data.
<html>
<script>
// CSV file for link visits
// if there are 3 links here , then the data for the matrix is 3x3 for the links.
var uris = "link,visits,color\n" +
"/discover,1000,#E41A1C\n" +
"/tv,800,#FFFF33\n" +
"/channels,150,#FF7F00\n";
// Visitors from one page to another, eg this says 4 visitors went /discover -> /tv
@base698
base698 / screenshot.sh
Last active February 11, 2017 01:17
Easy copy and paste markdown.
#!/bin/bash
bucket=rbmhmisc
uploaded_name=jt-$(date +"%Y-%m-%d-%s")-sn.png
s3_path=s3://$bucket/$uploaded_name
file=$(ls -tr ~/Desktop/Screen* | tail -n 1)
aws s3 cp "$file" "$s3_path" --acl public-read
@base698
base698 / perf
Created November 17, 2016 00:10
# hello world
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
@base698
base698 / HTTP.java
Last active November 9, 2016 16:22
Stack Trace
import java.net.URL;
import java.net.URLConnection;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.StringBuffer;
public class HTTP {
public static void get() throws Exception {
String urlString = "http://localhost:1234/";
@base698
base698 / handler.clj
Created October 26, 2016 02:46
You can create a template app with lein with: lein new compojure hello-world
(ns in-mem.handler
(:require [compojure.core :refer :all]
[compojure.route :as route]
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]))
(def start (slurp "../../tests/start.json"))
(defroutes app-routes
(GET "/start" [] start)
(route/not-found "Not Found"))
package main
import (
"github.com/couchbase/go-couchbase"
"flag"
"log"
"math/rand"
"fmt"
"time"
"strconv"
@base698
base698 / nginx.conf
Created August 24, 2016 19:37
nginx Built with: ./configure --add-module=../memc-nginx-module/ --add-module=../ngx_devel_kit/ --add-module=../set-misc-nginx-module/ --add-module=../redis2-nginx-module/ --add-module=../srcache-nginx-module/ --add-module=../echo-nginx-module/ --add-module=../ngx_http_redis-0.3.8
#user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@base698
base698 / load-users.sh
Created August 22, 2016 22:08
Create a bunch of random users for a PG Database
#!/bin/bash
psql < create.sql
shuffled=./shuffled-words.txt
cat /usr/share/dict/words | awk 'BEGIN{srand()}{printf "%06d %s\n", rand()*1000000, $0;}' | sort -n | cut -c8- | head -n 20000 > $shuffled
>inserts.sql
exec 5< $shuffled