Skip to content

Instantly share code, notes, and snippets.

View ethanjurman's full-sized avatar
🔬
Safety first is my suggestion when entering the 4th dimension!!

Ethan H. Jurman ethanjurman

🔬
Safety first is my suggestion when entering the 4th dimension!!
View GitHub Profile
import pyaudio
import numpy as np
import time
CHUNK = 2048
RATE = 44100
pa = pyaudio.PyAudio()
stream = pa.open(
// one class needs to have a main() method
public class HelloWorld
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
Node<Integer> nodeA = new Node<>(1);
Node<Integer> nodeB = new Node<>(2);
Node<Integer> nodeC = new Node<>(3);
Node<Integer> nodeD = new Node<>(4);
// one class needs to have a main() method
public class HelloWorld
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
Node<Integer> nodeA = new Node<>(1);
Node<Integer> nodeB = new Node<>(2);
Node<Integer> nodeC = new Node<>(3);
Node<Integer> nodeD = new Node<>(4);
@ethanjurman
ethanjurman / curry.js
Created March 15, 2016 18:42
This is a extremely simple way to curry a given function in javascript.
"use strict";
function makeCurry(func, context) {
let curryFunc = func;
for (let i = func.length; i > 1; i--) {
curryFunc = Function.bind.bind(curryFunc, context);
}
return curryFunc;
}
config = argv[argv.index("--")+1:]
for i in range(len(config)):
if config[i] == "True":
print('change to True ++')
config[i] = True
elif config[i] == "False":
print('change to False --')
config[i] = False
try:
config[i] = float(config[i])
<html>
<body>
<!-- what the card is going to look like -->
<div class="card">
<span class="name" name-attr="(data from mongodb)"> </span>
<span class="img" img-attr="(data from mongodb)"> </span>
<span class="attr1" data-attr1="(data from mongodb)"> </span>
<span class="attr2" data-attr2="(data from mongodb)"> </span>
<span class="attr3" data-attr3="(data from mongodb)"> </span>
</div>
@ethanjurman
ethanjurman / HoursMinutesSeconds.js
Created April 24, 2015 13:33
get hours minutes and seconds from a date time
Date.prototype.getHMS = function(){
var hours = (this.getHours() - 19) < 10 ? "0" + (this.getHours() - 19) : (this.getHours() - 19);
var minutes = this.getMinutes() < 10 ? "0" + this.getMinutes() : this.getMinutes();
var seconds = this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds();
return (hours + ":" + minutes + ":" + seconds);
}
// example
(new Date(70000)).getHMS() // => "00:01:10"
(new Date(800000)).getHMS() // => "00:13:20"
threads = []
count = 0
(0..360-4).step(4).each do |x|
threads << Thread.new() {
(0..360-4).step(4).each do |y|
(0..360-4).step(4).each do |z|
file = "C:\\tmp\\monkeyROTATE\\#{ "0"*(3-x.to_s.size) }#{x}#{ "0"*(3-y.to_s.size) }#{y}#{ "0"*(3-z.to_s.size) }#{z}_0001.bmp"
`convert #{file} -depth 1 ./bitMonkey/#{ "0"*(3-x.to_s.size) }#{x}#{ "0"*(3-y.to_s.size) }#{y}#{ "0"*(3-z.to_s.size) }#{z}.bmp`
end
end
words = []
charsHash = Hash.new(0)
string = gets().chop!.to_s.split("")
string.each do |char|
charsHash[char] = charsHash[char] + 1
end
parseString = "\\A"
charsHash.each do |char, num|
parseString << "[#{char}]{0,#{num}}"
#birthday.rb
birthdays_taken = []
doubles = false
while( !doubles ) do
if birthdays_taken.include?(y=rand(365))
doubles = true
end
birthdays_taken << y
end