Skip to content

Instantly share code, notes, and snippets.

View pestilence669's full-sized avatar

Paul Chandler pestilence669

View GitHub Profile
@pestilence669
pestilence669 / .eslintrc
Last active November 19, 2019 03:56
Misc Editor Stuff
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"nconf": true
},
"parser": "babel-eslint",
@pestilence669
pestilence669 / script.sh
Last active November 24, 2019 21:53
macOS Tweaks
# make the dock not so slow
defaults write com.apple.dock autohide-time-modifier -float 0.5
defaults write com.apple.dock autohide-delay -float 0.05
killall Dock
# disable shadow on screen capture
defaults write com.apple.screencapture disable-shadow -bool TRUE
killall SystemUIServer
@pestilence669
pestilence669 / flushDNSCache.sh
Last active February 5, 2019 21:07
Flush macOS DNS cache
dscacheutil -flushcache
sudo killall -USR2 mDNSResponder # <- required or name resolution may fail for SSH, ping, etc.
@pestilence669
pestilence669 / cleanupOldAppEngineVersions.sh
Created February 4, 2019 23:27
Delete old deployed versions on Google App Engine
#!/bin/bash
# vim: set ts=4 sw=4 noet fileencoding=utf-8:
readonly SERVICE=${1-api}
readonly versions=$(gcloud app versions list --service=$SERVICE \
--sort-by=~version.createTime \
--format='table[no-heading](id)')
declare -i KEEP_LAST=${KEEP_LAST-5}
declare -i c=0
@pestilence669
pestilence669 / aws_elb_log_parser.py
Last active September 21, 2018 18:44
Naïve Python AWS ELB log file regex parser
# vim: set ts=4 sw=4 et fileencoding=utf-8:
# The named tuple and JSON output are just examples / place holders.
from collections import namedtuple
from typing import Optional
import json
import re
import sys
@pestilence669
pestilence669 / spectre.c
Created January 4, 2018 05:25 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@pestilence669
pestilence669 / CoreBrightness.xdelta3
Last active October 30, 2017 06:33
Enable Night Shift on macOS 10.13 for MacBook Air 4,1+
@pestilence669
pestilence669 / github-to-bitbucket
Created March 9, 2017 02:28 — forked from sangeeths/github-to-bitbucket
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone [email protected]:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync [email protected]:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@pestilence669
pestilence669 / basic_benchmark_rig.py
Created March 8, 2017 10:53
Simple Python benchmark rig
#!/usr/bin/env python
# vim: set ts=4 sw=4 et fileencoding=utf-8:
#
# Simple benchmark & testing rig to play with finding the fastest methods when
# searching for the first value in a sequence, determined by a predicate. This
# file uses: lambda x: x / 2 == target
#
from __future__ import print_function
@pestilence669
pestilence669 / donteverdothis.c++
Last active February 13, 2017 22:38
Planting seeds for evil things to do to someone reading your code
// vim: set ts=4 sw=4 noet fileencoding=utf-8:
#include <iostream>
using namespace std;
#define _______ 0b0
#define ________ 0b1
#define _________ =
#define __________ <=
#define ___________ <<
#define ____________ int