Skip to content

Instantly share code, notes, and snippets.

@av1d
av1d / piano.py
Created February 22, 2022 17:50
Simple 1 octave piano in Python with live input
import numpy as np
import simpleaudio as sa
import os, sys, termios, time, tty
# Key mapping:
# W E T I U
# A S D F G H J K
#
# Which translates to:
# C#D# F#G#A#
@arielweinberger
arielweinberger / strong-password-regex.md
Last active September 8, 2024 06:47
Strong password Regular Expression - NestJS Course
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
@fnky
fnky / ANSI.md
Last active September 20, 2024 19:15
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

Most active GitHub users in Thailand

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 29 Jul 2015 01:52:41 GMT till Fri, 29 Jul 2016 01:52:41 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 6)
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active August 16, 2024 13:39
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@jamtur01
jamtur01 / ladder.md
Last active July 25, 2024 13:08
Kickstarter Engineering Ladder
@polymeris
polymeris / lisp.lua
Created September 15, 2015 15:10
Toy Lisp interpreter in Lua / LPEG
local lpeg = require'lpeg'
local P, R, S = lpeg.P, lpeg.R, lpeg.S --patterns
local C, Ct = lpeg.C, lpeg.Ct --capture
local V = lpeg.V --variable
local parser = P {
'program', -- initial rule
program = Ct(V'sexpr' ^ 0),
wspace = S' \n\r\t' ^ 0,
atom = V'boolean' + V'integer' + V'string' + V'symbol',
@PurpleBooth
PurpleBooth / README-Template.md
Last active September 18, 2024 04:31
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@Kartones
Kartones / postgres-cheatsheet.md
Last active September 20, 2024 08:36
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)