Skip to content

Instantly share code, notes, and snippets.

@namnh68
namnh68 / postgres-cheatsheet.md
Created June 13, 2024 01:15 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@namnh68
namnh68 / nginx-tuning.md
Created September 17, 2019 06:07 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@namnh68
namnh68 / byobuCommands
Created June 9, 2018 16:09 — forked from jshaw/byobuCommands
Byobu Commands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@namnh68
namnh68 / run_scheduled.py
Created April 22, 2018 16:19 — forked from numberoverzero/run_scheduled.py
00.async.periodic.rst
import asyncio
import functools
import json
import secrets
import aiohttp
from concurrent.futures import ALL_COMPLETED
@namnh68
namnh68 / asyncio-ping-output-3-hosts
Created April 21, 2018 00:06 — forked from tovin07/asyncio-ping-output-3-hosts
Simple python asyncio fake ping script
(ping-Qi9wEmSd) ➜ ping python ping.py
---> 0.000 s: Ping host #000
---> 0.000 s: Ping host #001
---> 0.000 s: Ping host #002
<--- 0.369 s: Pinged host #000 in 0.363 s
<--- 0.625 s: Pinged host #002 in 0.624 s
<--- 0.826 s: Pinged host #001 in 0.822 s
---> 2.006 s: Ping host #001
<--- 2.917 s: Pinged host #001 in 0.906 s
---> 3.004 s: Ping host #000
@namnh68
namnh68 / gist:86aba06d76a157da28aa20fc10d66811
Created February 23, 2018 10:40 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@namnh68
namnh68 / happy_git_on_osx.md
Created July 29, 2017 10:17 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

@namnh68
namnh68 / happy_git_on_osx.md
Created July 29, 2017 10:17 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

@namnh68
namnh68 / helloworld-win32-service.py
Created May 31, 2017 16:31 — forked from drmalex07/helloworld-win32-service.py
An example Windows service implemented with pywin32 wrappers. #python #windows-service #pywin32
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
import time
import logging
logging.basicConfig(
filename = 'c:\\Temp\\hello-service.log',
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static