Skip to content

Instantly share code, notes, and snippets.

View jamesmichiemo's full-sized avatar
☯️
casting lots

Mana jamesmichiemo

☯️
casting lots
  • University of North Carolina
View GitHub Profile
@jamesmichiemo
jamesmichiemo / rubyConditionals2.rb
Created June 24, 2013 15:56
Conditional expressions written in Ruby language
# Numerical Grade Converter
#
print "What percentage is your grade? "
gradePercent = gets.chomp().to_f
if gradePercent <= 69
puts "You have earned an F in the class!"
elsif gradePercent <= 72
puts "You have earned a D in the class!"
@jamesmichiemo
jamesmichiemo / makehtml.rb
Created September 26, 2013 10:07
a ruby script that rolls out a splash page using Bitstarter's template
print "Hi. Please enter the product name of your app: "
title = gets
print "Thank you. Now please enter a brief description for your app: "
description = gets
htmlfile = File.new("index.html", "w")
htmlfile.puts '<!DOCTYPE html>'
htmlfile.puts '<html lang="en">'
htmlfile.puts ' <head>'
htmlfile.puts ' <meta charset="utf-8">'
htmlfile.puts " <title>#{title}</title>"
@jamesmichiemo
jamesmichiemo / test.ck
Created October 8, 2013 04:43
a 440 sine wave using the chucK programming language
// connect sine oscillator to D/A convertor (sound card)
SinOsc s => dac;
// set frequency to 440
400. => s.freq;
// loop in time
while( true ) {
2::second => now;
}
print "We want... a shrubbery!"
@jamesmichiemo
jamesmichiemo / rpslS.py
Last active December 26, 2015 00:29
Rock Paper Scissors Lizard Spock
import random
def number_to_name(number):
if number==0:
return 'rock'
elif number==1:
return 'Spock'
elif number==2:
return 'paper'
@jamesmichiemo
jamesmichiemo / prelude.ck
Last active June 16, 2017 22:13
the melody sequence for Final Fantasy III's Prelude Theme written in the ChucK programming language
// James Michiemo 03nov13
TriOsc s => dac;
.7 => s.gain;
// music keys for the Final Fantasy Prelude Theme
// 1, 3
// c d e g g e d
// c d e g g e d c
@jamesmichiemo
jamesmichiemo / serverPID.sh
Created March 5, 2014 03:52
a script that identifies the PID of a running server.
lsof -wni tcp:3000
@jamesmichiemo
jamesmichiemo / setRemote.sh
Created March 5, 2014 06:57
After changing the name of a remote repository, I found that I was unable to push any commits in my branch. I had to reset the remote url locally by using these git commands.
#check the current url to see if it matches the remote url
git remote -v
#update to new url with command
git remote set-url origin git@github.com:username/newreponame.git
#ls remote branches to confirm connection
git ls-remote
@jamesmichiemo
jamesmichiemo / remove.sh
Created April 17, 2014 13:58
file removal from git history
git filter-branch --index-filter 'git rm --cached --ignore-unmatch screenshot.png' -- --all
sum = 0
(0...1000).each do |i|
sum += i if (i%3 == 0 || i%5 == 0)
end
puts "The sum total of all the multiples of 3 or 5 is #{sum}."