Skip to content

Instantly share code, notes, and snippets.

View nmarley's full-sized avatar
🦀
我想吃一點點東西。

Nathan Marley nmarley

🦀
我想吃一點點東西。
View GitHub Profile
@nmarley
nmarley / copy.rb
Created April 14, 2013 16:28
Ruby script that uses sequel to populate my new Rails database with data from my old (non-Rails) DB. Used a script instead of a standard Postgres copy to prevent gaps in auto-increment fields.
#!/usr/bin/env ruby
require 'sequel'
require 'pp'
# script to copy data from my old, non-Rails postgres DB to my new rails DB.
#
# The DB has users, which have a number of Lists.
# And Lists, which have a number of Items.
#
@nmarley
nmarley / runcmd.rb
Created April 15, 2013 02:13
Ruby function which runs a command and WAITS for it to finish before continuing processing.
#!/usr/bin/env ruby
def runcmd(cmd)
pid = Process.spawn(cmd)
Process.wait(pid)
unless ( $?.exited? && $?.exitstatus == 0 )
raise "oh noes"
end
$?.exitstatus
end
@nmarley
nmarley / git-start.rb
Created April 25, 2013 17:27
Quick-and-dirty utility to: 1) initialize a new git repo in the current directory (git init) 2) add all existing files, and: (git add .) 3) make an initial commit with message 'Initial commit' (git commit -m 'Initial commit') It won't run the commands if a git repo already exists. It checks the current directory only (does not accept a dir as an…
#! /usr/bin/env ruby
#
# git-start.rb
#
# Quick-and-dirty utility to initialize a new git repo in the current
# directory, add all existing files and make an initial commit with message
# 'Initial commit'.
#
# Saves a few seconds here and there.
#
@nmarley
nmarley / output
Created May 24, 2013 21:54
Example of how Btce::TradeAPI could be initialized
#<TradeAPI:0x007fd9143fc6c8 @key="YOUR-API-KEY", @secret="YOUR-SECRET-KEY">
#<TradeAPI:0x007fd9144134e0 @key="MY-OTHER-API-KEY", @secret="MY-OTHER-SECRET-KEY">
#<TradeAPI:0x007fd9144129a0 @key="Master key!", @secret="Super S33krit">
@nmarley
nmarley / openssl_output.txt
Created October 6, 2013 20:17
Output of the openssl command for the issue https://github.com/rubygems/rubygems/issues/665
depth=1 /C=US/O=GeoTrust, Inc./CN=RapidSSL CA
verify error:num=20:unable to get local issuer certificate
verify return:0
CONNECTED(00000003)
OCSP response: no response sent
---
Certificate chain
0 s:/serialNumber=RRAXldgzDrRZWQpGo6FHdTHV3qwvwXtD/OU=GT35895174/OU=See www.rapidssl.com/resources/cps (c)13/OU=Domain Control Validated - RapidSSL(R)/CN=*.rubygems.org
i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA
-----BEGIN CERTIFICATE-----
@nmarley
nmarley / tapi2.rb
Last active January 1, 2016 10:09
Ideal implementation of TradeAPI - factors out details of retrieving key/secret
#! /usr/bin/env ruby
class TradeAPI
attr_accessor :key
attr_accessor :secret
def initialize(key, secret)
@key = key
@secret = secret
@nmarley
nmarley / dash.js
Created January 8, 2016 04:56
Example usage of node-coind
var util = require('util')
var coind = require('node-coind')
var client = new coind.Client({
host: 'localhost',
port: 9998, // production = 9998
user: process.env.DARKCOINRPC_USER,
pass: process.env.DARKCOINRPC_PASS
})
var cb = function (err, data) {
@nmarley
nmarley / ptree.h
Created January 9, 2016 05:48 — forked from m-mizutani/ptree.h
Patricia Tree Template in C++
#ifndef __PTREE_H__
#define __PTREE_H__
#include <sys/types.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@nmarley
nmarley / bitwalletrecover.py
Created April 1, 2016 15:09 — forked from UdjinM6/bitwalletrecover.py
bitwalletrecover.py - recover compressed private keys from your bitcoin/litecoin/darkcoin wallet. Requires python3, pycoin (https://pypi.python.org/pypi/pycoin), and base58 (https://pypi.python.org/pypi/base58).
## bitwalletrecover.py - recover private keys from your darkcoin wallet
## (this version was not tested with bitcoin/litecoin).
## Requires python3, pycoin (https://pypi.python.org/pypi/pycoin),
## and base58 (https://pypi.python.org/pypi/base58).
##
## Starting with Python 3.4, pip is included by default with the Python binary
## installers. To install pip for older versions 3.x:
##
## sudo apt-get install python3-setuptools
## sudo easy_install3 pip
@nmarley
nmarley / README.md
Created August 11, 2016 23:33
SMB mount from OSX

smb_mount

Examples for mounting Windows network filesystem(s) from an OSX client.

  1. List available shares/disks on computer 'mb052361' (as local Windows user 'root'):

    smbutil view //root:password@mb052361

Output: