Skip to content

Instantly share code, notes, and snippets.

@andychase
andychase / chrome_xxd.py
Last active May 20, 2019 00:34
Google Chrome Cache Hex Dump To XXD
""" USEAGE: xclip -o | python chrome_xxd.py | xxd -r - [destination]
To access chrome's cache, go to about:cache in the address bar.
Make sure you copy the second section of the hex dump (the first section is the header).
"""
import sys
for line in sys.stdin.readlines():
sys.stdout.write(line[1:].replace(" ", " "))
@andychase
andychase / sample_args.py
Last active December 24, 2015 04:49
Minimal Python command line argument processing
#!python
""" A fairly simple way of parsing arguments without using libraries.
Licenced: http://creativecommons.org/publicdomain/zero/1.0/
"""
import sys
def main(_=None, argument_1="", argument_2="", *args):
if not argument_1:
print("need arg 1!)"
// This gist demonstrates a performance issue with DiffuseMap/DiffuseColor & directional light/shadow map in JME3
// Issue ticket: https://github.com/jMonkeyEngine/jmonkeyengine/issues/247
// Press Z/X to shift back and forth between the textures to see the performance diffence.
import com.jme3.app.SimpleApplication;
import com.jme3.input.ChaseCamera;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.AnalogListener;
import com.jme3.light.DirectionalLight;
import com.jme3.input.controls.KeyTrigger;
@andychase
andychase / googleforms2slack.gs
Last active February 15, 2024 07:53
Google Forms Slack Notification
// Google Forms Slack Notification
// Andy Chase <github.com/andychase>
// License: CC0 1.0 Universal <creativecommons.org/publicdomain/zero/1.0>
// Install 1: This code goes in ( tools > script editor... ) of your google docs form
// Install 2: ( resources > current project triggers ) ( [onSubmit], [from Form], [On form submit] )
// Setup 1: Put your slack api url below
var POST_URL = "https://hooks.slack.com/services/";
function onSubmit(e) {
@andychase
andychase / number_to_unique_tuple.py
Last active August 29, 2015 14:24
Split a number into tuples in a unique way each time
""" Andy Chase
>>> [number_to_unique_tuple(i, 256) for i in [0, 1, 2, 255, 256]]
[(0,), (1,), (2,), (255,), (0, 1)]
>>> [number_to_unique_tuple(i, 256, 1) for i in [0, 1, 2, 255, 256]]
[(0, 0), (1, 1), (2, 2), (255, 255), (0, 1)]
>>> [number_to_unique_tuple(i, 256) for i in [256*2, (256*256) - 2, (256*256) - 1, 256*256]]
[(0, 2), (254, 253), (255, 254), (0, 0, 1)]
>>> s = [number_to_unique_tuple(i, 256) for i in range(0,256*256)]
>>> len(list(s))
65536
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andychase
andychase / Dockerfile
Last active August 29, 2015 14:27
Faking XT Nodes for fun
# Use the Ubuntu Linux distro as the base for this image
FROM ubuntu
# Install necessary build tools
RUN apt-get update && apt-get upgrade --yes && apt-get install build-essential clang git --yes
# Download and install PseudoNode
RUN cd /root && git clone https://github.com/basil00/PseudoNode.git && cd ./PseudoNode && make
# These two commands enable port 8333 to be routed and start the node by default
EXPOSE 8333
CMD ["bash", "-c", "cd /root/PseudoNode && ./pseudonode --stealth --coin=bitcoin-xt"]
@andychase
andychase / spin_up_node.sh
Created August 25, 2015 04:21
Tesing Bitcoin XT Part 2
# Route port in range to 8333
for i in $(seq 40000 41000)
do echo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport $i -j REDIRECT --to-port 8333 &&
echo -n "."
done
# Create bitcoin data volume
docker run --name=bitcoind-data -v /bitcoin busybox chown 1000:1000 /bitcoin
# Spin up Bitcoin XT node
docker run --volumes-from=bitcoind-data --name=bitcoind-node -d \
@andychase
andychase / bipacceptanceprocess.mediawiki
Last active December 7, 2015 10:33
[BIP/Draft] Committee-based BIP Acceptance Process [Dev]

  Title: Committee-based BIP Acceptance Process
  Author: Andy Chase 
  Status: Draft 
  Type: Process 
  Created: 2015-08-31

Abstract

@andychase
andychase / biprealistic.mediawiki
Last active September 7, 2015 07:38
[BIP/Draft] BIP Realistic Acceptance Process Drinking Game

  Title: BIP Realistic Acceptance Process Drinking Game
  Author: Andy Chase 
  Status: Draft 
  Type: Process 
  Created: 2015-09-06

Abstract