Skip to content

Instantly share code, notes, and snippets.

View niderhoff's full-sized avatar

Nicolas Iderhoff niderhoff

View GitHub Profile
@malteneuss
malteneuss / Dockerfile
Created April 28, 2022 19:43
Nextjs + Prisma DB (query and migrations) in Docker
# Adapted from https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
# Install dependencies only when needed
FROM node:16-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Rebuild the source code only when needed
@oshliaer
oshliaer / readme.md
Last active December 9, 2022 13:57 — forked from NileDaley/repos.md
Change `cd` directory to the git repository using fzf (fuzzy search)

A git repositories finder on fzf

I use this little function (repo) on the command line to allow me to switch between different repositories easily using fzf

Prerequisits

  • fzf
  • zsh or bash

Installation

[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
rms = !"git rm --cached $(git ls-files --deleted)"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
@matthiassb
matthiassb / dns-sync.sh
Last active August 24, 2024 09:43
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@mrbar42
mrbar42 / README.md
Last active November 16, 2024 18:32
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@hersonls
hersonls / .zshrc
Created February 26, 2016 17:35
Auto load python virtual env and rename tmux window using zsh
# chpwd is a zsh hook, wich is executed after change directory
# More info: http://zsh.sourceforge.net/Doc/Release/Functions.html
function chpwd() {
if [ -z "$VIRTUAL_ENV" ]; then
# If exists a virtualenv with name of directory, load it!
workon ${PWD##*/} 2> /dev/null
else
# If a virtual env are loaded, rename window with they name
TMUX_WINDOW_NAME=$(tmux display-message -p '#W')
if [ $TMUX_WINDOW_NAME != ${VIRTUAL_ENV##*/} ]; then
@soheilhy
soheilhy / nginxproxy.md
Last active November 27, 2024 08:14
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@willurd
willurd / web-servers.md
Last active December 11, 2024 15:05
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@marcschwartz
marcschwartz / Measures.R
Last active June 19, 2023 04:03
R Code for miscellaneous measures of association
####################################################################
#
# All Code and Comments Below (except code provided by Boris Mayer) are
# Copyright Marc Schwartz
# e-mail: marc_schwartz@me.com
# This code is made available under the GNU Public License V2.0
# This is free software and comes with ABSOLUTELY NO WARRANTY.
#
####################################################################
@jaseemabid
jaseemabid / git tutorials.md
Last active August 26, 2024 02:27 — forked from netroy/git tutorials.md
Awesome git tutorials I am finding here and there