Skip to content

Instantly share code, notes, and snippets.

@Kartones
Kartones / postgres-cheatsheet.md
Last active April 24, 2024 11:43
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)
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active March 25, 2024 22:48
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@jpillora
jpillora / smtp-gmail-send.go
Last active March 5, 2024 21:26
Send email using Go (Golang) via GMail with net/smtp
package main
import (
"log"
"net/smtp"
)
func main() {
send("hello there")
}
@akashnimare
akashnimare / instructions.txt
Last active January 9, 2024 10:00
Download Frontend Master courses video. Note: This is for learning purpose only. Please don't mis-use it.
# Requirements
* Python 2.7
* Google Chrome
* ChromeDriver - WebDriver for Chrome
- Download the latest chromedrive which is 2.28 from here - https://sites.google.com/a/chromium.org/chromedriver/downloads
- Extract and move `chromedriver` file to `/usr/local/bin/chromedriver`
- git clone https://github.com/li-xinyang/OS_FrontendMaster-dl
- cd OS_FrontendMaster-dl
@aliartiza75
aliartiza75 / minio_mc.sh
Last active August 11, 2023 16:53
Command to use mini/mc with minio server
# Step 1 : Start minio server with non-persistent data storage policy
#
# Description: -p 9000:9000: Minio server runs on port 9000 inside the docker container, -e 9000:9000 command is exposing the internal port on
# on external port.
#
# -e "MINIO_ACCESS_KEY=access_key": It sets an envrionment variable inside container named as MINIO_ACCESS_KEY
# with the value provided by user. It will be used when a user wants to access
# minio server
#
# -e "MINIO_SECRET_KEY=access_key_secret": It sets an envrionment variable inside container named as MINIO_SECRET_KEY
@branneman
branneman / fp-lenses.js
Last active May 17, 2023 00:56
JavaScript: Lenses (Functional Programming)
// FP Lenses
const lens = get => set => ({ get, set });
const view = lens => obj => lens.get(obj);
const set = lens => val => obj => lens.set(val)(obj);
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj);
const lensProp = key => lens(prop(key))(assoc(key));
@pvencill
pvencill / LDAPjs New User
Last active January 19, 2023 04:44
Creating a new user in LDAPjs; complete example.
var ldap = require('ldapjs');
var ssha = require('node-ssha256');
var BASE = 'ou=Users,dc=example,dc=org';
// default port for ldaps
var URL = 'ldaps://ldap.example.org/:636';
// user and pass are for existing user with rights to add a user
@miguelmota
miguelmota / crypto.go
Last active November 2, 2022 21:19
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]