Skip to content

Instantly share code, notes, and snippets.

@tristan
tristan / test_transactions.sh
Last active October 26, 2020 16:12
testing parity instantSeal
#!/bin/bash
set -x
# find some available ports to use
PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
WS_PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
JSONRPC_PORT=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()')
# create a temp directory
TMP_DIR=$(mktemp -d)
@tristan
tristan / chain.json
Last active October 16, 2019 07:21
chainfile for parity 2.5.8
{
"name": "testing.parity.dev",
"params": {
"gasLimitBoundDivisor": "0x0400",
"accountStartNonce": "0x0100000",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"eip150Transition": "0x0",
"eip160Transition": "0x0",
"eip161abcTransition": "0x0",
#!/bin/bash
# Usage:
# ./convert_to_gif <INPUT> [ffmpeg args]
# e.g. to specify the length of the output: use ffmpeg arg `-t seconds`
# ./convert_to_gif some_long_video.mp4 -t 10
FPS=15
PTS=0.5 # https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
OUTPUT_WIDTH=400
THREADS=8
diff -u /home/tristan/projects/home/vulkan-tutorial/28_mipmapping.cpp /home/tristan/projects/home/vulkan-tutorial/29_multisampling.cpp
--- /home/tristan/projects/home/vulkan-tutorial/28_mipmapping.cpp 2019-06-07 17:09:04.120005112 +0200
+++ /home/tristan/projects/home/vulkan-tutorial/29_multisampling.cpp 2019-06-07 17:09:18.606672434 +0200
@@ -151,6 +151,7 @@
VkSurfaceKHR surface;
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE;
+ VkSampleCountFlagBits msaaSamples = VK_SAMPLE_COUNT_1_BIT;
VkDevice device;
@tristan
tristan / bot.conf
Created September 6, 2017 10:07
run toshi bot without docker
# required
TOKEN_APP_USERNAME=
TOKEN_APP_SEED=
# optional
STAGE=development
DATABASE_URL=postgres://toshi@localhost/toshi-bot-$(echo $TOKEN_APP_SEED | $(command -v md5sum || command -v md5) | cut -b -32)?sslmode=disable
#TOKEN_APP_NAME="Robot #"
LOG_LEVEL=DEBUG
ENABLE_LOG_TIMESTAMPS=1
@tristan
tristan / rename_commit_author.sh
Created April 19, 2017 00:13
Script to take the email address of a commit author and change every commit by that author to the new author
#!/bin/bash
set -euox pipefail
ORIG_AUTHOR=$1
NEW_AUTHOR=$2
for ORIG_HASH in $(git log --format=%h --author=$ORIG_AUTHOR); do
ORIG_BRANCH=$(git rev-parse --abbrev-ref HEAD)
CDATE=$(git show -s --format=%ci $ORIG_HASH)
git checkout $ORIG_HASH
GIT_AUTHOR_DATE=$CDATE GIT_COMMITTER_DATE=$CDATE git commit --amend --no-edit --author "$NEW_AUTHOR"
NEW_HASH=$(git rev-parse --short HEAD)
Verifying that "tristanking.id" is my Blockstack ID. https://onename.com/tristanking

Keybase proof

I hereby claim:

  • I am tristan on github.
  • I am tris (https://keybase.io/tris) on keybase.
  • I have a public key whose fingerprint is F326 68C0 18DB 5498 CF7C A6C8 7FCA 768E 493F 4F32

To claim this, I am signing this object:

@tristan
tristan / 99-evdev.conf
Last active August 29, 2015 14:05
xf86-input-evdev-remap patch for 2.9.2
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
MatchProduct "BD Remote Control"
Driver "evdev"
Option "event_key_remap" "119=65 159=41 161=39 207=33 256=53 311=86 313=82 315=33 357=54 371=52 358=31 401=25 407=37 412=34 436=59 437=60 438=54"
EndSection
@tristan
tristan / logrotate
Created August 16, 2012 08:27
Log rotate/cleanup script
#!/bin/bash
BASE_DIR=/tmp
mv $BASE_DIR/couchdb.log $BASE_DIR/couchdb-`date +%Y-%m-%d -d 'yesterday'`.log
touch $BASE_DIR/couchdb.log
LAST_WEEK=$BASE_DIR/couchdb-`date +%Y-%m-%d -d '8 days ago'`.log
if [ -a $LAST_WEEK ]
then
rm $LAST_WEEK
fi