Skip to content

Instantly share code, notes, and snippets.

View chaeplin's full-sized avatar

chaeplin chaeplin

View GitHub Profile
@nmarley
nmarley / swap-version.php
Last active December 15, 2016 02:28
BIP32 serialization version byte swap using BitWasp's bitcoin-php library
<?php
use BitWasp\Bitcoin\Base58;
use BitWasp\Buffertools\Buffer;
use BitWasp\Buffertools\BufferInterface;
use BitWasp\Buffertools\Buffertools;
require "./vendor/autoload.php";
class XKeyUtil {
import unittest
class User:
number = 1
articles = []
# def __init__(self):
# self.number = 1
# self.articles = []
@nmarley
nmarley / conv.rb
Last active August 9, 2017 17:20
Convert Dash BIP32 extended public key version prefix from 'xpub' to 'drkv'
#! /usr/bin/env ruby
# Utility converting BIP32 extended key version bytes
require './dashutil'
xkey = ARGV.shift
pref = ARGV.shift
# xpub661MyMwAqRbcFnEEbFf8idiyo8QGKiqhTujUmaJsDhAEZ82cEQPMq69Y4V27vGc5rJnxsd26kyHpBJDW72YMjntsmASbdBy1awfGMsUvLCa
@sr75
sr75 / osx-homebrew-setup.md
Last active June 18, 2020 06:35
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@ajfisher
ajfisher / _Ping I2C Johnny Five backpack.md
Last active March 24, 2021 16:20
Building an I2C backpack for HC-SR04 ultrasonic sensor

Building an ultrasonic sensor backpack

Note: This is a bit of a scratch to see what's involved in getting the ping sensor to work as an I2C backpack.

Acknowledgements

Dependencies.

#!/usr/bin/env python
"""
SNMP helper for HAproxy implementing EXCELIANCE-MIB with
`pass_persist` protocol. Data are retrieved from multiple instances of
haproxy using HTTP.
"""
def toOid(oid):
"""Convert a string to tuple OID"""
@laurenarcher
laurenarcher / livestreamingyoutube
Created November 21, 2014 14:13
Livestreaming to Youtube Live, Ubuntu, Linux FFMPEG
Terminal Commands:
One webcam:
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -vcodec libx264 -pix_fmt yuv420p -preset ultrafast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE
Two webcam overlay:
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -s 1280x720 -r 10 -i /dev/video1 -f v4l2 -s 320x240 -r 10 -i /dev/video0 -filter_complex "[1:v]setpts=PTS-STARTPTS[bg]; [2:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=shortest=1 [out]" -map "[out]" -map 0:a -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 25 -g 20 -b:v 2500k -codec:a libmp3lame -ar 44100 -threads 6 -b:a 11025 -bufsize 512k -f flv rtmp://a.rtmp.youtube.com/live2/YOURSTREAMNAMEHERE
@digitaljhelms
digitaljhelms / gist:1354003
Created November 10, 2011 03:10
Installing and using Gource on Mac OS X (only tested on Snow Leopard)

Gource

Gource is a software version control visualization tool.

Software projects are displayed by Gource as an animated tree with the root directory of the project at its centre. Directories appear as branches with files as leaves. Developers can be seen working on the tree at the times they contributed to the project.

http://code.google.com/p/gource/

Installing Gource Manually (w/out MacPorts or Homebrew)

@jackiekazil
jackiekazil / rounding_decimals.md
Last active January 17, 2024 12:29
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value

@igrr
igrr / esp8266_pubsubclient.ino
Created January 6, 2015 23:44
PubSubClient sample for ESP8266 Arduino
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
const char* ssid = ".................";
const char* password = "................";
char* topic = "esp8266_arduino_out";
char* server = "iot.eclipse.org";