Skip to content

Instantly share code, notes, and snippets.

View yangwao's full-sized avatar
🥋
Mastering the code

Matej yangwao yangwao

🥋
Mastering the code
View GitHub Profile
@yangwao
yangwao / gist:3328b61a1c4addb6ab50
Created July 5, 2015 11:29
Slow digitalocean?
I've just created $80/mo droplet at FRA1 ubuntu 15.04 x64 and this happend after I did $ apt-get install htop
Need to get 65.3 kB of archives.
After this operation, 203 kB of additional disk space will be used.
Get:1 http://mirrors.digitalocean.com/ubuntu/ vivid/universe htop amd64 1.0.3-1 [65.3 kB]
Fetched 65.3 kB in 31s (2,059 B/s)
@yangwao
yangwao / nginx.conf
Created March 10, 2016 00:35 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
⫸ cat /Users/wao/.npm/_logs/2017-05-06T09_46_27_579Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm5',
1 verbose cli 'i',
1 verbose cli '-g',
1 verbose cli 'standard-readme' ]
2 info using npm@5.0.0-beta.43
3 info using node@v7.9.0
4 notice BETA npm5 is beta software. Please see https://github.com/npm/npm/issues/16510 for known issues, and please file a new one if you find something new.
@yangwao
yangwao / gist:5a0a7ad54e668df5a8fca3fe62db2058
Created May 7, 2017 11:21
sudo BLUEBIRD_DEBUG=true npm5 i -g standard-readme
⫸ bash
bash-3.2$ sudo BLUEBIRD_DEBUG=true npm5 i -g standard-readme
npm notice BETA npm5 is beta software. Please see https://github.com/npm/npm/issues/16510 for known issues, and please file a new one if you find something new.
npm ERR! uid must be an unsigned int
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wao/.npm/_logs/2017-05-07T11_18_31_111Z-debug.log
bash-3.2$ cat /Users/wao/.npm/_logs/2017-05-07T11_18_31_111Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm5', 'i' ]
2 info using npm@5.0.0-beta.43
3 info using node@v7.9.0
4 notice BETA npm5 is beta software. Please see https://github.com/npm/npm/issues/16510 for known issues, and please file a new one if you find something new.
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly install normalizeTree
8 silly install loadIdealTree
9 silly install cloneCurrentTreeToIdealTree
@yangwao
yangwao / config.fish
Created May 13, 2017 10:29 — forked from ronaldsuwandi/config.fish
My personal fish shell config for OS X (better blue colour for directory in dark terminal). Supports git branch and virtualfish for virtualenv
# nice light cyan color instead of dark blue
set -gx LSCOLORS gxfxcxdxbxegedabagacad
function ls --description 'List contents of directory'
command ls -lhFG $argv
end
function df --description 'Displays disk free space'
command df -H $argv
end
@yangwao
yangwao / gist:5223042dfe17c2267ff433dc515c2d93
Created July 11, 2017 12:50
Date mystery with timezones
Local
⫸ node -v
v0.12.18
> date = new Date(2017, 06, 01)
Sat Jul 01 2017 00:00:00 GMT+0200 (CEST)
> Math.floor(date/(86400*1000)) + 1
17348
> date = new Date(Date.UTC(2017, 06, 01))
Sat Jul 01 2017 02:00:00 GMT+0200 (CEST)
> Math.floor(date/(86400*1000)) + 1
const r2 = require('r2')
const telegramUrl = 'https://api.telegram.org/bot'
const token = '180473239:VHqX8dOnuhGlJXyurVHqX8dO8yhqX8'
/**
* A basic reply bot
* @returns {object}
*/
module.exports = async (context) => {
const m = context.params.message
@yangwao
yangwao / post.json
Created May 17, 2018 18:34
http request
⫸ http -b POST https://api.telegram.org/bot180473239:VHqX8dOnuhGlJXyurVHqX8dO8yhqX8/setWebhook url=https://yangwao.lib.id/replybot@dev/
{
"description": "Webhook was set",
"ok": true,
"result": true
}
"curl - request POST - url https://api.telegram.org/bot575419417:AAEmmflOhwgZnMsut0ibQn1gY6i7Ym7q05Y/setWebhook - header 'content-type: application/json' - data '{"url": "https://JanethL.lib.id/replybot@dev/"}"