This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './drawer' | |
class Life | |
def initialize(window_x: 640, window_y: 480) | |
@window_x = window_x | |
@window_y = window_y | |
@cellsize = 8 | |
calcuate_bounds | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pi_piper' | |
include PiPiper | |
trigger_pin = PiPiper::Pin.new(pin: 25, direction: :out) | |
trigger_pin.off | |
sense_pin = PiPiper::Pin.new(pin: 18, direction: :in) | |
while true | |
sense = sense_pin.read | |
puts sense |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/user/bin/env ruby | |
# | |
# Demonstrates memory behaviour with zipruby vs rubyzip vs exec('unzip'). | |
# Tested with mri 1.8.7/1.9.3/2.1.2, zipruby 0.3.6 and rubyzip 1.1.6. | |
# | |
# Usage: ruby zipruby_test.rb <test method> | |
# | |
# Test methods are: | |
# read_zipruby read file from zip using zipruby gem | |
# read_rubyzip read file from zip using rubyzip gem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.git-prompt.sh | |
PS1="[\$(date +%H:%M:%S)]\[\033[0;37m\]\[\033[0;32m\]\w\[\033[0;37m\]\$(__git_ps1) \$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Delete all from sender - https://gist.github.com/xunker/44fa4404c882c27e0ad25857e9470552 | |
-- For the Mail.app in Mac OS X. It will search for all messages set by the sender of the email message currently open, | |
-- highlight them all and ask if you want to delete them. If you choose "yes" it will delete them for you and then clear | |
-- the search. | |
-- | |
-- Important notes: | |
-- You can load this in Script Editor and then save it as an application so you can run it without Script Editor being open. | |
-- This does not work when Mail.app is in fullscreen mode; it must be in windowed mode. | |
-- You will need to enable "Assistive Devices" support for Script Editor (if run there) or for the .app you saved if you converted it to a standalone app. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Drawing an N-gon around a circle using OpenSCAD | |
https://gist.github.com/xunker/daabf70dbb8e990077d3a1a11d1e06dd | |
Matthew Nielsen - github.com/xunker | |
Math credit: http://mathcentral.uregina.ca/QQ/database/QQ.09.06/s/cliff1.html | |
*/ | |
/* Diameter of the circle around which the n-gon will be built. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Originally based on https://gist.github.com/samervin/621fcde93d28346ec5dbab4466b51d45 | |
slacktoken="YOUR_SLACK_TOKEN" | |
apiurl="https://slack.com/api/users.profile.set?token="$slacktoken"&profile=" | |
# https://stackoverflow.com/questions/4481005/get-wireless-ssid-through-shell-script-on-mac-os-x | |
# This will probably only work on Mac OS 10.10+. | |
ssid=$(/usr/sbin/networksetup -getairportnetwork en0 | cut -c 24-) | |
echo $ssid | |
if [ "$ssid" = "WORK_NETWORK_NAME" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Visualizer to show sun and moon positions, give a certain time and position on | |
# the earth. | |
# | |
# Uses "gosu" so you will need to install the following libraries: | |
# * gosu (brew install gosu on macos) | |
# * sdl2 (brew install sdl2 on macos) | |
# | |
# Uses gems: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# IMPORTANT: Need to use pcb2gcode from git head, not the 2-year-old vesion 1.3.2 from homebrew or apt-get | |
# On Macos: brew install --HEAD pcb2gcode | |
# FILE_PREFIX="595 shift register demo" | |
# FILE_PREFIX="tp4056 charger carrier with ground copy" | |
# FILE_PREFIX="Sparkfun Moto_Bit hardware pull PTH" | |
# FILE_PREFIX="3.3v regulator" | |
FILE_PREFIX="3.3v regulator double sided" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# usage: split_drillfile.rb [<drill.ngc>] | |
# | |
# Reads a pcb2gcode drill file and creates individual files for each | |
# drill bit size. It will duplicate the preamble/postable between files. | |
# This is for programs like Universal Gcode Sender / UGS that do not let you | |
# change bits while streaming is paused because they do not allow you to move | |
# the head or reset the Z-axis while file streaming is paused. | |
# |