Skip to content

Instantly share code, notes, and snippets.

View ciatph's full-sized avatar
🌴
On vacation

ciatph ciatph

🌴
On vacation
View GitHub Profile
@ciatph
ciatph / git-export.bat
Last active August 20, 2019 14:44
Export the HEAD of a git repository to a specified directory or path.
::---------------------------------------------------------------------
:: A windows executable batch file that exports (checkout-index) the
:: current HEAD of a git repository to a specified directory.
:: - Uses relative directory access in case full path is not supplied.
:: - Exports contents to an "/export" directory inside the repository if no
:: argument is supplied
:: - Creates the entered directory if it does not yet exist
:: Dependencies: GitBash
:: madbarua;20180920
::---------------------------------------------------------------------
@ciatph
ciatph / country-bounding-boxes.py
Created November 19, 2018 02:17 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@ciatph
ciatph / System Design.md
Created September 25, 2019 14:30 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
// Create ssl certificates for localhost use only using openssl
openssl req -node -new -x509 -keyout server.key -out server.cert
@ciatph
ciatph / standard-git-commit-message-reference.md
Last active May 25, 2022 03:34
A list of industry-standard Git commit messages for reference

Standard Git Commit Message Reference

Below is a list of industry-standard Git commit messages featured by Tuasegun on his [blog post] for reference.

Your commit message should be:

  • Understandable
  • Enough
  • Unambiguous

Before coming up with a commit message you should consider:

@ciatph
ciatph / nginx.conf
Last active June 29, 2022 08:46 — forked from SaraVieira/nginx.conf
Minimal and effective nginx confg
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
@ciatph
ciatph / branch-namin-conventions.md
Last active July 31, 2022 20:25
Branch Naming Conventions

Branch Naming Conventions

(from @Phil Nord

Some Useful Guidelines

  1. Use grouping tokens (words) at the beginning of your branch names.
  2. Define and use short lead tokens to differentiate branches in a way that is meaningful to your workflow.
  3. Use slashes to separate parts of your branch names. 4.5Do not use bare numbers as leading parts.
  4. Avoid long descriptive names for long-lived branches.
@ciatph
ciatph / sqlite3-quick-cheats.md
Last active September 4, 2022 10:00
Sqlite3 Quick Cheats

Import a CSV File to Database

# Create a database
sqlite3 mydb.db

# Specify the CSV mode and define a table
.mode csv mytable

# Import a CSV file to mytable
.import somedata.csv mytable
@ciatph
ciatph / gist:4613e7c76f86acfb62d5ee3a9d694b69
Created December 5, 2022 19:55
download file to buffer in nodejs
const response = await axios.get(url, { responseType: 'arraybuffer' })
const buffer = Buffer.from(response.data, 'utf-8')