Skip to content

Instantly share code, notes, and snippets.

View ngryman's full-sized avatar

Nicolas Gryman ngryman

View GitHub Profile
@ngryman
ngryman / city_code.csv
Created March 11, 2022 08:31
German City Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
"city_code"
"A"
"AA"
"AB"
"ABG"
"ABI"
"AC"
"AE"
"AH"
"AIB"
@ngryman
ngryman / dshell
Created August 20, 2020 15:35 — forked from bcooksey/dshell
dshell: A little wrapper around the docker-compose run command that intelligently gets you a shell inside a container
#!/bin/bash
if [ ! -z $1 ]; then
MATCHER=$1
else
# Try to guess the project based on directory name
MATCHER=`pwd | sed 's/\/.*\///'`
fi
echo "Looking for web container named '$MATCHER'..."
@ngryman
ngryman / localhost-certificate.sh
Created July 17, 2020 17:53
Certificate generation for localhost
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
          🚀    
        ★○•     
     ¸. ¸☆ ☆      
    ° ○ ° ★       
   ☾ ★☆ ☾°      
 ° ☆ ○  ° . •     
  ○ ° ★☾ ☆

Ingredients

  • 250g lentils
  • 1 oinion
  • 3 garlic cloves
  • 1 fat tomatoe
  • 3 tbsp. olive oil
  • 1 tsp. of tomatoe paste
  • 1.5 tsp. of poudered cumin
  • 1 tsp. of poudered curcuma (or turmeric)
@ngryman
ngryman / keybase.md
Created October 26, 2019 20:53
Keybase verification

Keybase proof

I hereby claim:

  • I am ngryman on github.
  • I am ngryman (https://keybase.io/ngryman) on keybase.
  • I have a public key ASBd_NtgNSEMC6YmT6USKEd6kbAU4pf1_lxkPNrY2NVChQo

To claim this, I am signing this object:

@ngryman
ngryman / precommit.sh
Created October 15, 2019 11:06
Pre-commit hook to detect dependencies changes in a monorepo
has_package_changed=$(git diff --cached --quiet */package.json packages/*/package.json; echo $?)
if [ $has_package_changed = 1 ]; then
# do stuff
fi
@ngryman
ngryman / example.ts
Created June 29, 2019 17:24
Updating cached data from multiple parameterized queries after a mutation (hacky solution)
addTask({
variables: { input },
optimisticResponse: {
addTask: {
__typename: 'Task',
id,
...input
}
},
update: (proxy: any, { data: { addTask } }: any) => {
@ngryman
ngryman / create-gif.js
Created June 24, 2018 14:02
Keep the aspect ratio of your images using GIFs
function createGif(width, height) {
const b64wh = btoa(
String.fromCharCode(width & 0xFF) +
String.fromCharCode(width >> 8 & 0xFF) +
String.fromCharCode(height & 0xFF) +
String.fromCharCode(height >> 8 & 0xFF) +
String.fromCharCode(0) +
String.fromCharCode(0)
)
return `R0lGODlh${b64wh}ACwAAAAAAQABAAAC`
@ngryman
ngryman / create-gif.js
Created June 24, 2018 12:54
Keep the aspect ratio of your images using GIFs
function createGif(width, height) {
const buffer = new ArrayBuffer(24)
const byteView = new Uint8Array(buffer)
// signature
byteView.set([ 71, 73, 70, 56, 57, 97 ], 0)
// size
byteView.set([width, width >> 8], 6)
byteView.set([height, height >> 8], 8)