This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "runtime" | |
| ) | |
| func MaxParallelism() int { | |
| maxProcs := runtime.GOMAXPROCS(0) | |
| numCPU := runtime.NumCPU() |
This file contains hidden or 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 'prime' | |
| # Lets calculate some prime numbers | |
| primes = 40.times.map { |n| n**2+n+41 } #=> 40 prime numbers (41, 43, 47, …, 1523, 1601) | |
| # Let’s verify that they are in fact all prime numners | |
| primes == primes.select(&:prime?) #=> true |
This file contains hidden or 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
| [alias] | |
| churn = !git --no-pager log --name-only --oneline | grep -v ' ' | sort | uniq -c | sort -nr | head |
This file contains hidden or 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
| function setup() | |
| boolean("Skrivbordslampa", 1) | |
| boolean("Hörnlampa", 2) | |
| boolean("Sovrumslampa", 3) | |
| end | |
| function boolean(title, n) | |
| parameter.boolean(title, false, function(b) lamp(n, b) end) | |
| end |
This file contains hidden or 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 'prime' | |
| module Smith | |
| def smith? | |
| return false if self < 2 || self.prime? | |
| sum_of_digits == sum_of_prime_factors | |
| end | |
| def sum_of_digits | |
| to_s.split('').map(&:to_i).inject(:+) |
This file contains hidden or 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
| function run_remote_code(url) | |
| local eval_response = function(data, status, headers) | |
| if (status == 200) then | |
| code = string.gsub(data, '"', "'") | |
| loadstring(code)() | |
| end | |
| end | |
| http.request(url, eval_response) | |
| end |
This file contains hidden or 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
| var screenshot = require('url-to-screenshot'); | |
| var fs = require('fs'); | |
| var sys = require('sys') | |
| var exec = require('child_process').exec; | |
| if(process.argv[2]) { | |
| var url = process.argv[2]; | |
| screenshot(url) | |
| .width(800) |
This file contains hidden or 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
| fs = require('fs') | |
| isUSBModem = (element) -> | |
| element.match(/^cu.usbmodem\d+/) | |
| device = fs.readdirSync('/dev').filter(isUSBModem)[0] | |
| Cylon = require('cylon') | |
| Cylon.robot |
This file contains hidden or 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 cc.arduino.*; | |
| import processing.serial.*; | |
| import ddf.minim.*; | |
| import ddf.minim.analysis.*; | |
| Arduino arduino; | |
| AudioPlayer audio; | |
| Minim minim; | |
| FFT fft; |