Skip to content

Instantly share code, notes, and snippets.

@dmerrick
dmerrick / bitcoin_mining_example.rb
Created November 5, 2013 18:17
this is a simple script to generate checksums and find ones that start with zeros. when a matching checksum is found, it outputs it and looks for the a checksum with one more zero.
# this is a simple script to generate checksums and
# find ones that start with zeros. when a matching
# checksum is found, it outputs it and looks for
# the a checksum with one more zero.
# you can see in the output below that it took only
# 9 tries to find a checksum with one zero, and it
# took 6132845 tries to find one with six zeros.
# example output:
# in stratum-mining-proxy project
python setup.py install
cd midstatec && make && cd ..
./mining_proxy.py -o mining.eligius.st -p 3334 --custom-user 1JT86GVai2r7sixvsJfJxNWHon9Dep2erh
#TODO: figure out if we can remove midstate (-nm)
# run both:
#FIXME: change the wallet addresses
./mining_proxy.py -v -o mining.eligius.st -p 3334 -gp 8333 -sp 3333 --custom-user 1Do6mZGbXcRutqVxaMbdoiQrYNSQrfVuA4 --custom-password whatever
./mining_proxy.py -v -o mining.eligius.st -p 3334 -gp 8334 -sp 3334 --custom-user 1DQeV5UiVhHge95aT1vwgkMGngEtjX2ZLZ --custom-password whatever
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'open-uri'
require 'slack-notifier'
# use the turtle subreddit
turtles = "http://www.reddit.com/r/turtle.json"
json = JSON.load(open(turtles))
#!/bin/bash
black='\e[47m'
red='\e[31;41m'
blue='\e[34;44m'
blueonred='\e[34;41m'
reset='\e[0m'
echo -e "${blue}iiiiii${reset} ${blueonred}@@@@@@${red}llllllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset}"
echo -e "${blue}iiiiii${reset} ${blueonred}@@@@@@${red}llllllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset} ${red}lllll${blueonred}@@@@@@${red}lllll${reset}"
@dmerrick
dmerrick / workspace.yml
Last active October 16, 2016 00:30
~/.tmuxinator/workspace.yml
# ~/.tmuxinator/workspace.yml
name: workspace
root: ~/
# Optional tmux socket
# socket_name: workspace
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
@dmerrick
dmerrick / poc.rb
Created September 24, 2014 23:46
Use encrypted data bags without chef
#!/usr/bin/env ruby
# this is a proof-of-concept for reading encrypted data bags
# from a ruby script. you only need chef to be installed.
require 'rubygems'
require 'chef/rest'
require 'chef/encrypted_data_bag_item'
# prevent chef from trying to contact a server
Chef::Config[:solo] = true
@dmerrick
dmerrick / dmv_alerter.rb
Created October 7, 2014 23:34
Let me know when the DMV line is short!
#!/usr/bin/env ruby
# this script will scrape the CA DMV website for wait times,
# and if the wait is less than a certain threshold, it will
# alert you with an audible message (at least on OS X).
require 'open-uri'
require 'date'
# found from http://apps.dmv.ca.gov/web/fieldoffice.html?number=503
@branch_id = 503
#!/usr/bin/env ruby
# this script takes a URL and verifies that
# every css file included loads correctly
require 'open-uri'
require 'nokogiri'
require 'pry' if $DEBUG
url = ARGV.shift || 'https://ifttt.com'
doc = Nokogiri::HTML(open(url).read)
# I don't know if the guide goes on to address these points,
# but I thought it might be kinda fun to help you on your path.
if 4 > 5
# ruby programmers tend to use 2 spaces instead of 4 for indentation
# also, even though it's confusing, you'll generally use "puts" instead of "print"
puts "I'm soooo wrong it's painful"
# I like to avoid using parentheses to group things, so I'd rewrite what you had as:
#elsif 4 > 5 != true
#!/usr/bin/env ruby
puts "Why is the FBI after you?"
# optional, but you can chain the downcase here
text = gets.chomp.downcase
# the default parameter for String#split is ' ', so you can omit it
words = text.split
# note that since text was only used here, you could have just said:
#words = gets.chomp.downcase.split