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
require 'json' | |
require 'open-uri' | |
raw_json = open('http://api.smartcitizen.me/v0.0.1/ba997ab4b0e21eda08b3da4a7b60a628/646/posts.json?from_date=2014-02-06&to_date=2014-02-08').read | |
json = JSON.parse(raw_json) | |
File.open('posts.csv', 'w') do |file| | |
# write first line | |
file.puts json["device"]["posts"][0].keys.join(',') |
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
min = 2 | |
max = 100 | |
min.upto(max) do |count| | |
puts "k=#{count}" | |
a = (1..count).to_a | |
options = a.repeated_combination(count).to_a | |
for option in options.reverse |
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
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
source ~/.bashrc | |
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
rbenv install 2.1.5 | |
rbenv global 2.1.5 | |
ruby -v |
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
/coverage | |
*.todo |
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
#!/bin/bash | |
set -e | |
need_rails=1 | |
if [ $# -gt 0 ]; then # we have args | |
filename=$1 | |
# remove trailing line number from filename e.g. spec/my_spec.rb:33 | |
grep_filename=`echo $1 | sed 's/:.*$//g'` |
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
sudo apt-get update | |
mkdir -p /usr/local/java | |
cd /usr/local/java | |
wget http://www.reucon.com/cdn/java/jdk-7u76-linux-x64.tar.gz | |
tar xvzf jdk-7u76-linux-x64.tar.gz | |
vim /etc/profile | |
JAVA_HOME=/usr/local/java/jdk-7u76-linux-x64 | |
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin | |
JRE_HOME=/usr/local/java/jdk-7u76-linux-x64 | |
PATH=$PATH:$HOME/bin:$JRE_HOME/bin |
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
syntax: regexp | |
# files with special characters | |
[^\w.\-\/ ]+ | |
# banned extensions, still relatively flexible | |
(?i)^(.+)\.(db|php|php4|php5|swp|log|tmp|\d+)$ |
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
$('table#log_table tr').each(function(index, tr) { | |
var a = $('td', tr).map(function(index, td) { | |
return $(td).text(); | |
}); | |
console.log("curl -v -X POST -H 'Host: sc.dev' -H 'User-Agent: SmartCitizen' -H 'X-SmartCitizenMacADDR: " + a[1] + "' -H 'X-SmartCitizenVersion: "+ a[2]+"' -H 'X-SmartCitizenData: [{\"temp\":\""+a[4]+"\",\"hum\":\""+a[5]+"\",\"light\":\""+a[6]+"\",\"bat\":\""+a[7]+"\",\"panel\":\""+a[8]+"\",\"co\":\""+a[9]+"\",\"no2\":\""+a[10]+"\",\"noise\":\""+a[11]+"\",\"nets\":\""+a[12]+"\",\"debug_push\": 1,\"timestamp\":\""+a[13]+"\"}]' sc.dev/add") | |
}); |
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
## All MPs | |
https://twitter.com/tweetminster/lists/ukmps | |
## Parties | |
https://twitter.com/conservatives | |
https://twitter.com/cchqpress | |
https://twitter.com/david_cameron | |
https://twitter.com/uklabour | |
https://twitter.com/labourpress |
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
{ | |
"id": "wanhaoduplicatori3", | |
"name": "Wanhao Duplicator i3", | |
"platform_texture": "WanhaoDuplicatori3Backplate.png", | |
"inherits": "ultimaker2.json", | |
"machine_settings": { | |
"machine_width": { | |
"default": 200 | |
}, | |
"machine_depth": { |
OlderNewer