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
sudo dd if=./some.linux.iso | pv -s 2G | sudo dd of=/dev/sdb bs=8192 |
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 akka.actor.ActorSystem | |
import akka.stream.scaladsl._ | |
import akka.stream._ | |
object AkkaStreamExample extends App { | |
implicit val system = ActorSystem("MyActorSystem") | |
implicit val materializer = ActorMaterializer() | |
val source = Source(1 to 5) | |
val square = Flow[Int].map(x => x * x) |
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 | |
# Step 1. Install pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc | |
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc | |
source ~/.bashrc |
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 | |
pids_to_kill=$(ps aux|grep $1|grep -v grep|grep -v terminate.sh |awk '{print $2}') | |
[[ ! -z $pids_to_kill ]] && kill -9 $pids_to_kill |
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
du -h | grep '^[0-9]\.*[0-9]*G' |
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() { | |
function toArray(arrayLike) { | |
return [].slice.call(arrayLike); | |
} | |
function $(cssSelector) { | |
return toArray(document.querySelectorAll(cssSelector)); | |
} |
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 print(obj) { | |
console.log(JSON.stringify(obj, null)); | |
} | |
function* gen() { | |
var x = yield 'a'; | |
var y = yield 'b'; | |
var z = yield 'c'; | |
return [x, y, z]; |
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 listMonths() { | |
var currentDate = new Date(); | |
return Array.from(new Array(12), (_, monthIdx) => { | |
currentDate.setMonth(monthIdx); | |
return currentDate.toLocaleString("en-US", {month: "long"}) | |
}); | |
} | |
console.log(listMonths()); |
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 spawn = require('child_process').spawn; | |
var sh = spawn('sh'); | |
sh.stdout.on('data', function (data) { | |
console.log('sh: \n', data.toString()); | |
}); | |
sh.stderr.on('data', function (data) { | |
console.error('error: \n', data.toString()); |
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
{- | |
Copyright (c) 2014-2016, Evan Czaplicki | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright notice, this | |
list of conditions and the following disclaimer. |