Skip to content

Instantly share code, notes, and snippets.


Jumpei Ogawa phanect

View GitHub Profile
View gist:ebfc640f2af51377188f1ef6c6296237
docker run --rm -it -p 4000:80 -v /path/to/siteroot:/var/www/html php:apache-buster
phanect /
Last active Mar 7, 2021
Create database
View assertObj.js
* Assert if objects are equal. This function also considers `not`
* @return true if obj1 and obj2 are equal, otherwise false
function _objEquals(obj1, obj2) {
const keys1 = obj1.getOwnPropertyNames().sort(sortByCharCode),
keys2 = obj2.getOwnPropertyNames().sort(sortByCharCode),
sortByCharCode = function(key1, key2) {
if (key1 < key2) {
return -1;

How to show total directory size of directories in current directory:

$ du --max-depth=1 -h ./
47M     ./foo
2.0M    ./bar
6.6G    ./hoge
4.0K    ./fuga
View docker-cleanup
docker rm --force $(docker ps --all --quiet); docker rmi --force $(docker images --all --quiet); docker volume rm $(docker volume ls --quiet)
phanect / dropnhalt
Last active May 28, 2016
Shutdown computer when Dropbox sync finished
View dropnhalt
dropbox start
while [[ $(dropbox status) != "Up to date" ]]; do
sudo echo $(dropbox status)
sleep 120
done && sudo shutdown now
View saveAs.js
// window.saveAs
// Shims the saveAs method, using saveBlob in IE10.
// And for when Chrome and FireFox get round to implementing saveAs we have their vendor prefixes ready.
// But otherwise this creates a object URL resource and opens it on an anchor tag which contains the "download" attribute (Chrome)
// ... or opens it in a new tab (FireFox)
// @author Andrew Dodson
// @copyright MIT, BSD. Free to clone, modify and distribute for commercial and personal use.
window.saveAs || ( window.saveAs = (window.navigator.msSaveBlob ? function(b,n){ return window.navigator.msSaveBlob(b,n); } : false) || window.webkitSaveAs || window.mozSaveAs || window.msSaveAs || (function(){
View copydir.js
var fs = require("fs");
function copydir(srcdir : string, destdir : string, options) {
var _srcdir = srcdir.endsWith("/") ? srcdir : srcdir + "/";
var files = fs.readdirSync(srcdir);
files.forEach(function(filename) {
var srcfilepath = _srcdir + file;
if (options.emptydir) {
phanect /
Created May 19, 2013
Export all pages of Pukiwiki to html pages. Optimized for KDE Capacity framework.