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
esphome: | |
name: pool-sensor | |
esp32: | |
board: heltec_wifi_lora_32_V2 | |
framework: | |
type: arduino | |
logger: |
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
class MyModel | |
def my_column | |
if self.has_attribute?(:my_column_JSON) | |
self.my_column_JSON | |
else | |
self.attributes[:my_column] | |
end | |
end | |
def my_column=(value) |
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
% dig rainforest.dev | |
; <<>> DiG 9.10.6 <<>> rainforest.dev | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39596 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 | |
;; OPT PSEUDOSECTION: | |
; EDNS: version: 0, flags:; udp: 1452 |
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
function faucet(session) { | |
// send $0.10 USD at current exchange rates | |
let amt = 0.1 | |
let count = (session.get('count') || 0) + amt | |
session.set('count', count) | |
Fiat.fetch().then((toEth) => { | |
session.sendEth(toEth.USD(amt)) | |
sendMessage(session, `Sent ${amt} 💰🤑💰`) |
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
class A | |
def version | |
self.class::VERSION || 1 | |
end | |
end | |
class B < A | |
VERISON = 2 | |
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
docker run --rm -it -v "$(pwd)":/app -w /app crystallang/crystal:latest sh -c 'crystal build --release src/hello.cr' |
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
var request = require('request'); | |
return function (context, callback) { | |
var required_params = ['TWILIO_AUTH_TOKEN', 'TWILIO_ACCOUNT_SID', 'TWILIO_NUMBER', 'SEARCH', 'TO']; | |
for (var p in required_params) | |
if (!context.data[required_params[p]]) | |
return callback(new Error('The `' + required_params[p] + '` parameter must be provided.')); | |
function message(to, message) { | |
request({ |
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
sample_data = [0, 1, 100, 99, 0, 10, 90, 30, 55, 33, 55, 75, 51, 49, 50, 51, 49, 51] | |
sample_output = [[1,99], [0,100], [10,90], [51,49], [50,50]] | |
var results = []; | |
for (var i = 0; i < sample_data.length; i++) { | |
for (var j = i + 1; j < sample_data.length; j++) { | |
if (sample_data[i] + sample_data[j] == 100) { | |
var combo = sample_data[i] | |
if (results.indexOf(sample_data[i]) == -1 && results.indexOf(100 - sample_data[i]) == -1) { | |
results.push(combo); |
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
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { | |
director := func(req *http.Request) { |
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
from __future__ import division | |
import urllib, json, string, datetime | |
from itertools import permutations | |
from math import log | |
def _bf(V, E, src): | |
# init | |
dist = dict(zip(V, [float('Inf') for v in V])) | |
pred = dict(zip(V, [None for v in V])) |
NewerOlder