Skip to content

Instantly share code, notes, and snippets.

@zavarat
zavarat / tmux-cheatsheet.markdown
Created October 20, 2017 06:27 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@zavarat
zavarat / sql-mongo_comparison.md
Created October 20, 2017 06:51 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@zavarat
zavarat / sed_snippets.sh
Created January 5, 2018 18:57 — forked from r2k0/sed_snippets.sh
sed examples
##FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
# triple space a file
@zavarat
zavarat / docker_cheat.md
Created March 23, 2018 02:47 — forked from nacyot/docker_cheat.md
도커(Docker) 치트 시트

Docker 치트 시트

한국어 번역(초벌) : nacyot

왜 Docker를 사용해야하는가?

Why Should I Care (For Developers)

"나에게 Docker의 매력은 간단히 격리된 환경을 만들 수 있다는 것과, 그러한 환경을 재사용할 수 있다는 점이다."런타임 환경을 한 번 만들어 패키지로 만들면, 이 패키지를 다른 어떤 머신에서도 다시 사용할 수 있다. 또한 여기서 실행되는 모든 것은 마치 가상머신과 같이 호스트로부터 격리되어있다. 무엇보다도 이런 모든 일들이 빠르고 간단히 가능하다.

@zavarat
zavarat / digest.js
Created April 10, 2018 15:30 — forked from LPGhatguy/digest.js
Half-baked HTTP/HTTPS Digest Authentication for node.js.
var http = require("http");
var https = require("https");
var crypto = require('crypto');
function HTTPDigest(username, password, use_https) {
this.username = username;
this.password = password;
this.use_https = use_https;
}
@zavarat
zavarat / basic_auth_nodejs_test.js
Created June 8, 2018 03:54 — forked from charlesdaniel/basic_auth_nodejs_test.js
Example of HTTP Basic Auth in NodeJS
var http = require('http');
var server = http.createServer(function(req, res) {
// console.log(req); // debug dump the request
// If they pass in a basic auth credential it'll be in a header called "Authorization" (note NodeJS lowercases the names of headers in its request object)
var auth = req.headers['authorization']; // auth is in base64(username:password) so we need to decode the base64
console.log("Authorization Header is: ", auth);
@zavarat
zavarat / 00-genieacs.md
Created June 8, 2018 06:28 — forked from AfroThundr3007730/00-genieacs.md
My notes on setting up and configuring GenieACS.

Config files to get GenieACS up and running on Debian Testing, complete with GUI, Nginx SSL proxy, and systemd services.

Following the documentation here for dependencies, here for initial setup, then the wiki here for Nginx and SSL, should get you most of the way there. After that, I had a lot of googling to do, the results of which you can find below.

Filename Description
01-install.sh The installation instructions and commands.
02-config.json The genieacs services configuration.
03-openssl.cnf The openssl certificate configuration.
04-.env The environmental variables for genieacs-gui.
@zavarat
zavarat / aws-docker-high-tracffic-kernel.md
Created January 7, 2019 06:01 — forked from ruseel/aws-docker-high-tracffic-kernel.md
AWS에서 docker를 쓸 때 high traffic server라면 이렇게

AWS에서 docker를 쓸 때 high traffic server라면 이렇게 하는 것이 좋겠다. amazon linux를 쓴다고 하자.

ulimit

ulimit를 올려주어야 한다. /etc/security/limit.conf 에서 고쳐주어도 docker에는 적용되지 않는다. limit.conf는 PAM을 통해서 로그인했을 때만 먹는 설정이라 그렇다. docker로 띄운 process의 pid를 찾고 cat /proc/<pid>/limits를 실행해서 보면 적용되었는지 아닌지 확실하게 알 수 있다. kernel에서 직접 그 프로세스에 어떤 ulimit이 적용되었는지 확인하는 방법이다.

그래서 /etc/sysconfig/docker 파일을 만들고 아래를 추가한다.

@zavarat
zavarat / Multiline Curl PUT'ing of data with no extra processing.sh
Created February 12, 2019 04:53 — forked from Integralist/Multiline Curl PUT'ing of data with no extra processing.sh
Multiline Curl PUT'ing of data with no extra processing (thanks to --data-binary flag). We also use @ with a hyphen, so @- (the hyphen indicates input from stdin)
curl -E $DEV_CERT_PEM https://api.our-service.com/component/component-name/configuration --header 'Content-Type: application/json' --request PUT --data-binary @- <<BODY
[
{
"key": "git_ssh_private_key",
"value": "$(cat pri.key)",
"secure": true
},
{
"key": "git_ssh_public_key",
"value": "$(cat pub.key)",
@zavarat
zavarat / docker-compose.yml
Created March 20, 2019 08:48 — forked from ju2wheels/docker-compose.yml
docker-compose reference YAML file with comments
# https://docs.docker.com/compose/yml/
# Each service defined in docker-compose.yml must specify exactly one of
# image or build. Other keys are optional, and are analogous to their
# docker run command-line counterparts.
#
# As with docker run, options specified in the Dockerfile (e.g., CMD,
# EXPOSE, VOLUME, ENV) are respected by default - you don't need to
# specify them again in docker-compose.yml.
#
service_name: