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
/*
*
* Mongo-Hacker
* MongoDB Shell Enhancements for Hackers
*
* Tyler J. Brock - 2013
*
* http://tylerbrock.github.com/mongo-hacker
*
*/
@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 / iptables.sh
Created May 22, 2013 02:33
iptables startup script, put it in /etc/init.d/
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: iptables
# Required-Start: mountkernfs $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Set up iptables rules
### END INIT INFO
@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
@tankywoo
tankywoo / github.css
Created February 23, 2016 02:47 — forked from andyferra/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 {
# Copyright (c) 2011 Phil Plante <unhappyrobot AT gmail DOT com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@tankywoo
tankywoo / color_print.py
Created December 18, 2013 02:07
color print
RESET_COLOR = "\033[0m"
COLOR_CODES = {
"debug" : "\033[1;34m", # blue
"info" : "\033[1;32m", # green
"warning" : "\033[1;33m", # yellow
"error" : "\033[1;31m", # red
"critical" : "\033[1;41m", # background red
}