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
import pyaudio | |
import numpy as np | |
import time | |
CHUNK = 2048 | |
RATE = 44100 | |
pa = pyaudio.PyAudio() | |
stream = pa.open( |
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
// 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); |
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
// 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); |
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
"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; | |
} |
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
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]) |
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
<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> |
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
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" |
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
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 |
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
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}}" |
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
#birthday.rb | |
birthdays_taken = [] | |
doubles = false | |
while( !doubles ) do | |
if birthdays_taken.include?(y=rand(365)) | |
doubles = true | |
end | |
birthdays_taken << y | |
end |
NewerOlder