Skip to content

Instantly share code, notes, and snippets.

View dekz's full-sized avatar
🐢
⠚⠁⠉⠕⠃

Jacob Evans dekz

🐢
⠚⠁⠉⠕⠃
View GitHub Profile
@dekz
dekz / fstash.zsh
Last active April 12, 2023 00:15
fzf + git stash
fstash() {
local out q k sha
while out=$(
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" |
fzf --ansi --no-sort --query="$q" --print-query \
--expect=ctrl-d,ctrl-b);
do
IFS=$'\n'; set -f
lines=($(<<< "$out"))
unset IFS; set +f
@dekz
dekz / k6.js
Last active October 22, 2019 01:41
import http from 'k6/http';
const SRA_ENDPOINT = 'https://sra.0x.org';
let pairs;
export default function() {
if (!pairs) {
pairs = http.get(`${SRA_ENDPOINT}/v2/asset_pairs?perPage=300`).json().records;
console.log(JSON.stringify(pairs));
}
@dekz
dekz / aws-logs-tail-group.sh
Created November 14, 2016 11:48 — forked from tekwiz/aws-logs-tail-group.sh
AWS Logs Tailer
#!/bin/bash
group_name='<log-group-name>'
start_seconds_ago=3600
aws_cmd_opts= # e.g. "--profile <profile-name>"
# Usage: get_loglines "<log-group-name>" <start-time>
get_loglines() {
aws $aws_cmd_opts --output text logs filter-log-events \
--log-group-name "$1" \
@dekz
dekz / cloudformation.sh
Created February 13, 2017 11:00
CI AWS Cloudformation
#!/bin/bash
set -e
: "${CLOUDFORMATION_STACK?must be set, e.g CLOUDFORMATION_STACK='Event-Backbone-Dev-Jacob' }"
: "${CLOUDFORMATION_FILE?must be set, e.g CLOUDFORMATION_FILE='CLOUDFORMATION_FILE=./cloudformation/event-backbone/event-backbone.yaml' }"
: ${AWS_DEFAULT_REGION='ap-southeast-2'}
: ${S3_BUCKET='test'}
: ${CHANGESET_NAME="$CLOUDFORMATION_STACK$BUILDKITE_NUMBER"}
# Upload to s3, some files are too big
import {
assetDataUtils,
BigNumber,
ContractWrappers,
generatePseudoRandomSalt,
Order,
orderHashUtils,
signatureUtils,
SignedOrder,
SignerType,
0xbA648D24bD63c90f19E3161b6FF813D3bf9e347C
@dekz
dekz / iTerm2Build.sh
Created April 20, 2016 12:29
Custom iTerm2 Build Script
#!/bin/bash
# Original idea from here: http://superuser.com/questions/810582/iterm-osx-terminal-change-text-margin-from-edge-of-window
# Download, unzip, clean up.
wget --quiet https://github.com/gnachman/iTerm2/archive/master.zip
unzip master.zip
rm master.zip
# Go into project directory.
@dekz
dekz / README.md
Created November 13, 2013 23:37 — forked from JoelBesada/README.md

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.
  • Google Chrome + Firefox
  • iTerm2
  • Better Touch Tool
  • Little Snitch
  • 1Password
  • Flux
  • Caffeine
  • Xcode command-line tools
  • Homebrew
  • Rbenv + ruby-build + ruby-2.0.0
[{"match_id"=>106984628,
"start_time"=>1359040453,
"lobby_type"=>0,
"players"=>
[{"account_id"=>4294967295,
"player_slot"=>0,
"hero_id"=>40,
"hero_name"=>"Venomancer"},
{"account_id"=>4294967295,
"player_slot"=>1,