Skip to content

Instantly share code, notes, and snippets.

View TonsOfFun's full-sized avatar
🏠
Working from home

Justin Bowen TonsOfFun

🏠
Working from home
View GitHub Profile
@TonsOfFun
TonsOfFun / string_v_symbol_hashes.rb
Created September 20, 2012 07:18
String Vs Symbol Hashes
require 'benchmark'
n = 100_000
Benchmark.bm do |x|
x.report("string_hash:") do
n.times do
string_hash = {"test" => "some string"}
string_hash["test"]
end
@TonsOfFun
TonsOfFun / gist:6137791
Created August 2, 2013 06:02
weird shit
[
{
"created_at": "Fri Aug 02 02:41:51 +0000 2013",
"id": 363127475540623360,
"id_str": "363127475540623360",
"text": "I love this. #KennyChesney with my bff.",
"source": "<a href="http: //twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TonsOfFun
TonsOfFun / reduce_image.rb
Last active January 3, 2016 04:59
mini_magick to reduce filesize while retaining maximum quality
original_file_path = ''
new_file_path = ''
original_file = MiniMagick::Image.open(original_file_path)
og = original_file
og.combine_options do |ops|
ops.quality "85"
ops.interlace "Plane"
ops.strip
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TonsOfFun
TonsOfFun / docker-compose.yml
Created May 14, 2018 16:17
Crypto Smart Camera POC
version: '3'
services:
miner:
image: cryptotrust/rpi-cpuminer-multi
command: "cpuminer -u ${EMAIL} -a ${ALGO} -o stratum+tcp://${URL}:${PORT} -t ${THREADS}"
camera:
image: ricklon/rpi-opencv
command: python motion_capture.py
volumes:
- .:/greenthumb-rails
@TonsOfFun
TonsOfFun / docker-compose.yml
Created May 14, 2018 16:39
Crypto Smart Camera POC: Docker Compose
version: '3'
services:
miner:
image: cryptotrust/rpi-cpuminer-multi
command: "cpuminer -u ${EMAIL} -a ${ALGO} -o stratum+tcp://${URL}:${PORT} -t ${THREADS}"
camera:
image: ricklon/rpi-opencv
command: python motion_capture.py
volumes:
- .:/greenthumb-rails
@TonsOfFun
TonsOfFun / mineroutput.bash
Last active May 14, 2018 16:56
Crypto mining on 2 of 4 CPU cores on pi with rpi-cpuminer-multi
pi@raspberrypi:~ $ sudo docker run cryptotrust/rpi-cpuminer-multi --algo cryptonight-light
--url stratum+tcp://aeon.pool.host.com:45690 --user [email protected] --t
hreads 2
** cpuminer-multi 1.3.3 by tpruvot@github **
BTC donation address: 1FhDPLPpw18X4srecguG3MxJYe4a1JsZnd (tpruvot)
[2018-05-13 23:58:28] Using JSON-RPC 2.0
[2018-05-13 23:58:28] CPU Supports AES-NI: NO
[2018-05-13 23:58:28] Starting Stratum on stratum+tcp://aeon.pool.host.com:45690
[2018-05-13 23:58:28] 2 miner threads started, using 'cryptolight' algorithm.
@TonsOfFun
TonsOfFun / motion.py
Created May 14, 2018 17:04
Crypto Smart Camera: Basic Motion
import imutils
def motion(current_frame=None, previous_frame=None, avg=None, min_area=2000):
motion = False
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (21, 21), 0)
# if the average frame is None, initialize it
if avg is None: