Skip to content

Instantly share code, notes, and snippets.

View tankywoo's full-sized avatar

Tanky Woo tankywoo

View GitHub Profile
@tankywoo
tankywoo / polyfills.js.patch
Created November 25, 2020 03:06
Fix gitbook-cli graceful-fs/polyfills.js cb.apply is not a function problem
As gitbook-cli is no longer maintained, there is a bug for its required library.
> /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287
> if (cb) cb.apply(this, arguments)
> ^
> TypeError: cb.apply is not a function
> at /usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18
For MacOS, the patch file is:
/usr/local/lib/node_modules/gitbook-cli/node_modules/npm/node_modules/graceful-fs/polyfills.js
ref:
- https://stackoverflow.com/a/64211387/1276501
@tankywoo
tankywoo / curl.md
Created March 7, 2018 06:07 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@tankywoo
tankywoo / tmux-cheatsheet.markdown
Created September 28, 2016 14:46 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tankywoo
tankywoo / web-servers.md
Created May 8, 2016 09:36 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
/*
*
* Mongo-Hacker
* MongoDB Shell Enhancements for Hackers
*
* Tyler J. Brock - 2013
*
* http://tylerbrock.github.com/mongo-hacker
*
*/
@tankywoo
tankywoo / github.css
Created February 23, 2016 02:47 — forked from theconektd/github.css
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@tankywoo
tankywoo / atom.xml
Last active December 23, 2015 14:12
for simiki
<?xml version="1.0" encoding="utf-8"?>
{% if site.url %}
{% set site_url = "%s%s"|format(site.url, site.root) %}
{% else %}
{% set site_url = site.url %}
{% endif %}
<feed xmlns="http://www.w3.org/2005/Atom">
<generator uri="http://simiki.org/" version="{{ site.version }}">Simiki</generator>
<title>{{ site.title }}</title>
<link href="{{ site_url }}/" />
@tankywoo
tankywoo / gh-pages-deploy.md
Created November 11, 2015 07:09 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@tankywoo
tankywoo / calculate_dir.py
Last active October 14, 2015 05:34
calculate directory size
# http://stackoverflow.com/questions/1392413/calculating-a-directory-size-using-python
import os
def get_size(start_path = '.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".