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
# Create a certificate | |
sudo letsencrypt certonly --webroot \ ~ | |
-w /srv/path/to/document/root \ | |
-d my.working.fqdn | |
# Help on renew. See Also: https://certbot.eff.org/docs/using.html#re-running-certbot | |
letsencrypt --help renew | |
# Update created certificates | |
sudo letsencrypt renew --agree-tos \ |
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
mongodump --port <PORT like 27018> --db <DATABASE> --collection <COLLECTION> |
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
#!/bin/bash | |
# Colors: | |
# 1: Red | |
# 2: Greed | |
# 3: Yellow | |
# 4: Blue | |
# 5: Magenta | |
# 6: Cyan | |
# 7: White |
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
const sliceTodos = todos => | |
todos.length <= 3 | |
? [todos, []] | |
: [todos.slice(0, 3), todos.slice(3)] | |
const square = (x, callback) => | |
setTimeout(() => callback(x ** 2), 1000) | |
const squarePromise = x => | |
new Promise(resolve => square(x, res => resolve(res))) |
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
const expect = require('expect') | |
const groupItems = (array = [], count) => | |
array.reduce( | |
(prev, cur) => { | |
const lastIndex = prev.length - 1 | |
return lastIndex === -1 ? [[cur]] | |
: prev[lastIndex].length === count ? [...prev, [cur]] | |
: [...prev.slice(0, -1), [...prev[lastIndex], cur]] | |
}, |
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 assert from "assert" | |
import co from "co" | |
import http from "http" | |
import request from "request" | |
describe("request", () => { | |
it("should make a GET request", () => co(function *() { | |
const server = http.createServer((req, res) => res.end("あばば")) | |
server.listen(5000) |
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
curl -LO http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz | |
curl -LO https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz | |
curl -LO https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz | |
tar xzf ncurses-6.0.tar.gz && \ | |
cd ncurses-6.0 && \ | |
./configure --prefix $HOME/local && \ | |
make && make install && \ | |
cd .. |
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
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
use HTTP::Message::PSGI; | |
use HTTP::Request::Common; | |
use Plack::Response; | |
use Plack::Test; | |
my $app_with_plack_response = sub { | |
my $res = Plack::Response->new(200); |
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
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
my @keys = 1 .. 20; | |
my %key_map = map { $_ => 1 } @keys; | |
cmpthese( | |
5_000_000, | |
{ 'with grep()' => sub { |
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
use strict; | |
use warnings; | |
use Benchmark qw(cmpthese); | |
my @keys = 1 .. 20; | |
my %key_map = map { $_ => 1 } @keys; | |
cmpthese( | |
5_000_000, | |
{ 'with grep()' => sub { |