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
#!/usr/bin/env bash | |
echo -n $(for l in $(for l in $(grep -Eo 'class=r>(.*)+</tr' <(curl -s "https://www.timeanddate.com/worldclock/sunearth.html")); do echo $l | grep -v "^<"; done | head -n2); do echo -n $(echo -n $l | sed 's/ //g' | sed 's/West/W/' | sed 's/South/S/' | sed 's/North/N/' | sed 's/East/E/' | sed 's/<\/td><td>/0"/' | cut -d'>' -f2 | cut -d'<' -f1),; done | cut -d',' -f-2) |
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
#!/usr/bin/env node | |
const stdin = require('/usr/local/lib/node_modules/get-stdin') | |
const { parseDms } = require('/usr/local/lib/node_modules/dms-conversion') | |
const nearbyCities = require('/usr/local/lib/node_modules/aynik-nearby-cities') | |
const { NEAREST_CITY_DEBUG } = process.env | |
const getNearestCity = (latitude, longitude) => ( | |
((data) => ( | |
NEAREST_CITY_DEBUG |
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
#!/usr/bin/env node | |
// dependencies: npm install --global wrtc | |
// usage: node p2p-coinflip.js [offer?] | |
const crypto = require('crypto') | |
const readline = require('readline') | |
const zlib = require('zlib') | |
const { | |
RTCPeerConnection, |
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 Lnd < Formula | |
desc "Lightning Network Daemon" | |
homepage "http://dev.lightning.community/" | |
url "https://github.com/lightningnetwork/lnd.git", | |
:branch => "master" | |
head "https://github.com/lightningnetwork/lnd.git" | |
version "0.3.0" | |
depends_on "go" => :build |
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 StateMachine from './StateMachine' | |
class Account extends StateMachine { | |
constructor (initialState, initialBalance = 0) { | |
super(initialState) | |
this.balance = initialBalance | |
} | |
static get openStateMethods () { | |
return { |
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
#!/usr/bin/env node | |
// requires: npm i -g get-stdin net-ping | |
// usage: ping-rng [bits?] < hosts | |
const stdin = require('/usr/local/lib/node_modules/get-stdin') | |
const ping = require('/usr/local/lib/node_modules/net-ping') | |
let sid = 0 | |
const probe = async (hosts) => { |
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
#!/usr/bin/env node | |
// discogs2spotify <spotify-playlist-id> <start-year>-<end-year> [discogs search params] | |
const args = require("minimist")(process.argv); | |
const Spotify = require("spotify-web-api-node"); | |
const Discogs = require("disconnect").Client; | |
const Confirm = require("prompt-confirm"); | |
const Prompt = require("prompt-base"); | |
const DISCOGS_USER_TOKEN = "<DISCOGS_USER_TOKEN>"; |
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
const SOLID = "SOLID"; | |
const LIQUID = "LIQUID"; | |
const GAS = "GAS"; | |
const transitions = { | |
[SOLID]: { | |
melt: LIQUID, | |
sublimate: GAS, | |
}, | |
[LIQUID]: { |
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 FieldRoot(object): | |
def __init__(self, __id__, __parent_repr__=lambda x: x): | |
self.__id__ = __id__ | |
self.__parent_repr__ = __parent_repr__ | |
def __repr__(self): | |
return self.__parent_repr__(self.__id__) | |
def __embed__(self, child, __id__): | |
return child(__id__, |
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 django.db import models | |
class Item(models.Model): | |
title = models.CharField(max_length=128) | |
class GroupItems(models.Model): | |
group = models.ForeignKey(Group) | |
item = models.ForeignKey(Item) | |
class Group(models.Model): |
OlderNewer