Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

P Ξ D R O L U Z Narven

👾
Walking to the fridge...
View GitHub Profile
@Narven
Narven / gitcheats.txt
Created March 31, 2021 15:27 — forked from mkhairi/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# push changes to an empty git repository for the first time
git push --set-upstream origin master
# Remove + and - from start of diff lines
git diff --color | sed "s/^\([^-+ ]*\)[-+ ]/\\1/" | less -r
# clear out git hooks
@Narven
Narven / check.go
Created February 25, 2021 12:33 — forked from mattes/check.go
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@Narven
Narven / .gitlab-ci.yml
Created February 5, 2021 17:27 — forked from ChugunovRoman/.gitlab-ci.yml
Deploy Electron app with gitlab ci
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/download?job=pages
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/raw/<path_to_file>?job=pages
# Where:
# example.com - domain name your gitlab server
# namespace - your name user on the gitlab
# project - your project
# tag - ref of current job.
# If job run on only by tags, than ref will be named as tag name
# If job run on only master, than ref will be named as "master", i.e.: https://<example.com>/<namespace>/<project>/-/jobs/artifacts/master/download?job=pages
# path_to_file - path to file relative from root workspace folder
@Narven
Narven / dummy-web-server.py
Created February 2, 2021 15:21 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@Narven
Narven / server.py
Created February 2, 2021 12:51 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
@Narven
Narven / custom-entity-not-found-exception-filter.md
Created January 4, 2021 07:11 — forked from gsusmonzon/custom-entity-not-found-exception-filter.md
Make NestJs returns 404 when EntityNotFoundError exception is thrown

Make NestJs returns 404 when EntityNotFoundError exception is thrown

When using findOrFail() or findOneOrFail() from typeORM, a 500 error is returned if there is no entity (EntityNotFoundError).

To make it returns a 404, use an exception filter as described in https://docs.nestjs.com/exception-filters .

file /src/filters/entity-not-found-exception.filter.ts

@Narven
Narven / ultimate-ut-cheat-sheet.md
Created October 13, 2020 14:58 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest

The Ultimate Unit Testing Cheat-sheet

For Jest, Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@Narven
Narven / .env
Last active October 8, 2020 16:31
Docker compose config for fast postgres
POSTGRES_USER=REPLACE
POSTGRES_PASSWORD=REPLACE
POSTGRES_DB=REPLACE_dev
POSTGRES_HOST=localhost
@Narven
Narven / .vimrc
Created September 2, 2020 09:15 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@Narven
Narven / Tmuxinator config
Created August 28, 2020 10:20 — forked from ekazakov/Tmuxinator config
tmuxinator config
# ~/.tmuxinator/main.yml
name: main
root: ~/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start