Skip to content

Instantly share code, notes, and snippets.

View ejc123's full-sized avatar

Eric.J.Christeson ejc123

  • Fargo, North Dakota, USA
View GitHub Profile
@ctufts
ctufts / PhlCrime_GettingStarted_PT_I_II.R
Last active November 7, 2015 22:35
The script imports Philadelphia Crime Data Parts I and II (https://www.opendataphilly.org/dataset/crime-incidents), creates a summary based on year, month, and crime type and creates a basic map in leaflet using the first 1000 incidents
# the following script will import Philadelphia Crime Data
# Parts I and II, create a summary based on year, month, and crime type
# and will create a basic map in leaflet using the first 1000 incidents
# you will need to install dplyr, leaflet, readr, lubridate, and stringr
# packages ( install.packages('package name') )
rm(list = ls())
library(dplyr)
library(leaflet)
library(readr)
module Main where
import Control.Monad.Eff
import Data.Array (replicate, (!!), updateAt)
import Data.Maybe.Unsafe (fromJust)
import Data.Nullable (toMaybe)
import Prelude
import DOM.HTML (window)
import DOM.HTML.Document (body)
@rbnpi
rbnpi / SP_RotatingBinaryRhythms.rb
Last active January 31, 2016 05:23
SP_RotatingBinaryRhythms uses an idea from http://bernhardwagner.net/musings/RPABN.html developed to give four sets of rotating rhythms playing together. Tested on Pi2 and Mac. Hear it at https://soundcloud.com/rbnman/sp-rotatingbinaryrhythms
#Rotating binary rhythms by Robin Newman, January 2016
#This piece was inspired by an article I read at http://bernhardwagner.net/musings/RPABN.html
#I played with the idea and extended it to give the current piece.
#set_sched_ahead_time! 4 #I set this when recording on a Pi2 to prevent errors
use_debug false
######### three user settings below ###########
rvol=0.6 #balance these two vol settings to taste (0-1)
lvol=1
numpasses=4 #set for number of passes required (pattern repeats after 4 passes)
@vysakh0
vysakh0 / any.ex
Created February 10, 2016 03:49
Remove any given character in a string just using recursion
defmodule Any do
def remove(str, char) do
remove("", str, char)
end
def remove(newstr, << char :: binary-size(1), rest :: binary >>, char) do
remove(newstr, rest, char)
end
def remove(newstr, << first :: binary-size(1), rest :: binary >>, char) do
remove(newstr <> first, rest, char)
end
@dangkhoasdc
dangkhoasdc / lenet5.lua
Last active November 6, 2019 23:44
CNN with Torch: A simple example
-- LUA WARNINGS
-- Array starts from index 1
-- obj.func() is equivalent to obj:func()
-- Loop:
-- for start_, end_ do
-- end
-- Condition:
-- if <condition> then
-- end
-- Function:
@aviflombaum
aviflombaum / adele.hello.rb
Created March 22, 2016 01:22
Opening chords of Hello by Adele in Sonic Pi
use_synth :piano
use_bpm 148
play(chord(:F1, :minor), amp: 2, release: 16)
# play(:Gs3, release: 16)
# play(:C2, release: 16)
# play(:F1, release: 16)
sleep 3
@emlyn
emlyn / guitar.rb
Last active May 14, 2024 14:11
Strumming guitar chords in Sonic Pi
# Guitar Strumming - by Emlyn
# This tries to work out the guitar (or ukulele etc.) fingering for arbitrary chords (and tuning).
# It seems to work reasonably well for basic chords, but is quite naive and probably makes many mistakes.
# Ideas, bug reports, fixes etc. gratefully received, just comment below, or tweet @emlyn77.
# Feel free to make use of this code as you like (with attribution if you feel like it, but you don't have to).
# Thanks to @Project_Hell_CK for fixing the tuning, and spotting that it gets chord(:f, :major) not quite right.
# Next note higher or equal to base note n, that is in the chord c
define :next_note do |n, c|
# Make sure n is a number
@srdjan-m
srdjan-m / optimized_badass.rb
Last active December 29, 2016 02:56
sonic_pi: optimized badass
# "The Optimized Badass"
# Sonic Pi v2.11
# ----------------------------------------
# Samples used in this song can be downloaded from:
# https://dl.dropboxusercontent.com/u/657073/sonicpi/badass-samples.zip
# Unpack and put them into your samples folder.
# ----------------------------------------
# This file is too long to be played from the Sonic Pi IDE
# Instead of pasting this code, just enter the following into the Sonic Pi editor:
# run_file "/path/to/this_file.rb"
@Ch4s3
Ch4s3 / install_and_deploy_elixir_phoenix_on_centos7_rhel.md
Last active April 30, 2022 19:44
Instructions for installing Elixir 1.4, Phoenix 1.2.x, and Erlang 19+ on Centos7/RHEL and deploy with edeliver and distillery. Webpack + React + Yarn for JS

Set the environment variables

Install nano(or not if you intend to use vi)

yum install -y nano

Open ~/.profile with nano ~/.profile and add the following:

@rbnpi
rbnpi / FyGarRubHerOerWithStraw.rb
Last active May 23, 2017 17:10
Sonic Pi plays Fy Gar Rub Her O'er With Straw Traditional Scottish Song played on harpsichord, music from Robert Bremner The Harpsichord and Spinnet Miscellany circa 1765. Listen to it on https://soundcloud.com/scrbn/fygarrubheroerwithstraw
#Fy gar her o'er with Straw arranged for Sonic Pi by Robin Newman, May 2017
#anon scottish song
#music from The harpsichord or spinnet miscellany by Robert Bremner (c 1765)
use_synth :blade #makes a good harpsichord sound when gverb added
use_bpm 140
#note values relative to crotchet=1
m=2;cd=1.5;c=1;q=0.5;sq=0.25;dsq=0.125;hdsq=0.0625;qd=0.75
define :shake do |n,d,f=0| #quick entry for ornament