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 when = require('when'); | |
var when_node = require('when/node'); | |
// a function that sends `data` | |
// waits `cycles` milliseconds to simulate network delay | |
// calls the `callback` after `data` is sent | |
function send_with_callback(data, cycles, callback) { | |
console.log(new Date().toISOString(), 'sending data', data); | |
setTimeout(callback, cycles); | |
} |
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/sh | |
ping -c 1 8.8.8.8 &> /dev/null && ping -c 1 www.google.com &> /dev/null && echo 'We are able to resolve host names to IP addresses!' || echo 'We are connected to the internet, but we are incapable of resolving host names to IP addresses!' |
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 fs = require('fs'); | |
var parse = require('csv-parse'); | |
var input = fs.readFileSync('myfile.csv').toString('ascii'); | |
// remove the 3rd line from the file | |
var lines = input.split('\n'); | |
lines.splice(2, 1); | |
input = lines.join('\n'); | |
parse(input, { comment: '#' }, function(err, lines) { |
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
# remount the partition as read-write so we can modify the filesystem | |
mount -o remount,rw / | |
# add the default nameservers so that they are appended to resolv.conf | |
echo "nameserver 8.8.8.8" >> /etc/resolvconf/resolv.conf.d/base | |
echo "nameserver 8.8.4.4" >> /etc/resolvconf/resolv.conf.d/base | |
# ask the user to reboot so the changes take place and filesystem is read-only again | |
echo "Please reboot for the changes to take." |
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 feature foo-bar (creates a branch called feature-foo-bar) | |
# ... | |
# git publish | |
git config --global alias.feature "!f() { git checkout -b feature-\$1 develop; }; f" | |
git config --global alias.publish-feature "!f() { LOCAL=\$(git rev-parse --abbrev-ref HEAD); FEATURE=\$(echo \$LOCAL | sed -E 's/^.{8}//'); git checkout develop && git merge \$LOCAL && git branch -d \$LOCAL && git push origin develop; }; f" | |
# git release 1.0.0 (creates a branch called release-v1.0.0) | |
# ... | |
# git publish | |
git config --global alias.release "!f() { git checkout -b release-v\$1 develop && ./bump-version \$1 && git commit -a -m \"Updated version to \\\`\$1\\\`.\"; }; f" |
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 randomString(len) { | |
var s = ''; | |
while (s.length < len) { | |
s += Math.random().toString(36).substr(2); | |
} | |
return s.substr(0, len); | |
} |
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 request = require('superagent'); | |
const { domain, key, secret } = require('./godaddy.json'); | |
function callback(resolve, reject) { | |
return (error, value) => { | |
if (error) return reject(error); | |
return resolve(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
#!/usr/bin/env bash | |
YEAR=$(date +"%Y") | |
NPM_VERSION=$(npm -v) | |
NODE_VERSION=$(node -v) | |
NODE_VERSION=${NODE_VERSION:1} | |
if [ "$GITHUB_USER" == "" ]; then |
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
#include <stdio.h> | |
#include <unistd.h> | |
typedef enum { | |
INIT, | |
DEBUG, | |
INC, | |
INC_ASYNC, | |
DEC, | |
DEC_ASYNC |
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> | |
<head> | |
<style> | |
body { | |
margin: 0; | |
} | |
*, | |
*:before, |
OlderNewer