Skip to content

Instantly share code, notes, and snippets.

🔨
Woodworking

Rob Cameron cannikin

🔨
Woodworking
Block or report user

Report or block cannikin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:de18c08eab69e03da44ae8faf7388e60
{
"binary_file_patterns":
[
"log/",
"tmp/"
],
"ensure_newline_at_eof_on_save": true,
"rulers":
[
80
View Packages\User\RubyTest-Twilight.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>TestConsoleTheme</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
View Gemfile
source 'https://rubygems.org'
# Gems needed for edge rails
gem 'rails', github: "rails/rails"
gem 'sprockets-rails', github: "rails/sprockets-rails"
gem 'sprockets', github: "rails/sprockets"
gem 'sass-rails', github: "rails/sass-rails"
gem 'arel', github: "rails/arel"
gem 'rack', github: "rack/rack"
@cannikin
cannikin / deploy.rb
Last active Oct 22, 2018
Notify Sentry of a new release via Capistrano
View deploy.rb
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
View logstasher.json
{"method":"GET","path":"/","format":"*/*","controller":"index","action":"index","status":200,"duration":2.51,"view":0.91,"db":0.0,"ip":"50.31.164.139","route":"index#index","request_id":"1b8d526e74667b136c5b6c33adec241d","parameters":{},"user_id":null,"server":"prod1","source":"workingnotworking.app.prod","tags":["request"],"@timestamp":"2015-11-11T21:25:24Z","@version":"1"}
{"method":"GET","path":"/messages/notifications","format":"*/*","controller":"messages","action":"notifications","status":200,"duration":5.61,"db":2.56,"ip":"2.136.171.212","route":"messages#notifications","request_id":"6fd9ddd3d818954c3b7bf3f07d8b9a21","parameters":{"since":"1444824793"},"user_id":3428,"server":"prod1","source":"workingnotworking.app.prod","tags":["request"],"@timestamp":"2015-11-11T21:25:24Z","@version":"1"}
{"method":"GET","path":"/messages/notifications","format":"html","controller":"messages","action":"notifications","status":200,"duration":46.33,"db":43.06,"ip":"108.60.145.130","route":"messages#notifications","requ
@cannikin
cannikin / remote_ip.rb
Created Nov 10, 2015
Rails code for raising ActionDispatch::RemoteIp::IpSpoofAttackError
View remote_ip.rb
# Determines originating IP address. REMOTE_ADDR is the standard
# but will be wrong if the user is behind a proxy. Proxies will set
# HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR, so we prioritize those.
# HTTP_X_FORWARDED_FOR may be a comma-delimited list in the case of
# multiple chained proxies. The last address which is not a known proxy
# will be the originating IP.
def calculate_ip
client_ip = @env['HTTP_CLIENT_IP']
forwarded_ips = ips_from('HTTP_X_FORWARDED_FOR')
remote_addrs = ips_from('REMOTE_ADDR')
@cannikin
cannikin / make_install.out
Last active Oct 3, 2015
Post portaudio instructions on the Pi
View make_install.out
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
View gist:dfc7d07c241773160c3c
pi@picluster1 ~/superham $ ruby demod-raw.rb iq.dat
Reading file iq.dat...
Read 5100000 data points from file.
6:1 low pass filter...
Now 850000 samples.
FM demodulator...
Deemph filter...
Reducing low pass real filter...
Now 160000 samples.
Playing 160000 data points.
View rtl_fm options
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers
Use: rtl_fm -f freq [-options] [filename]
-f frequency_to_tune_to [Hz]
use multiple -f for scanning (requires squelch)
ranges supported, -f 118M:137M:25k
[-M modulation (default: fm)]
fm, wbfm, raw, am, usb, lsb
wbfm == -M fm -s 170k -o 4 -A fast -r 32k -l 0 -E deemp
raw mode outputs 2x16 bit IQ pairs
View 100000 samples = 441291000 Hz
pi@picluster1 ~ $ sudo rtl_fm -f 441M -M wbfm -s 100000 -r 48000 -l 80 - | aplay -r 48k -f S16_LE
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to automatic.
Tuned to 441291000 Hz.
Oversampling input by: 11x.
Oversampling output by: 1x.
You can’t perform that action at this time.