Skip to content

Instantly share code, notes, and snippets.

View foxxyz's full-sized avatar

Ivo Janssen foxxyz

View GitHub Profile
@foxxyz
foxxyz / deploy.sh
Last active July 19, 2023 23:14
Generic Deploy Script
#!/usr/bin/env bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
DEPLOY_DIR="/opt/org/project"
DEPLOY_MODE="production"
RSYNC_DIR=$DEPLOY_DIR
SCP_DIR=$DEPLOY_DIR
cd $SCRIPT_DIR
# Exit if any of the commands fail
@foxxyz
foxxyz / .zshrc
Last active December 23, 2021 01:10
.zshrc
# <3 emacs
export EDITOR=/opt/homebrew/bin/emacs
# Add nice color prompt
autoload -U colors && colors
PROMPT="%F{red}[%T]%f %F{green}%3~ > %f"
# I like my ls more advanced
alias ls='ls -Glash'
@foxxyz
foxxyz / post-receive
Last active April 9, 2020 19:51
Node.js post-receive hook example
#!/usr/bin/env node
// post-receive hook for git-push deployments
const fs = require('fs')
const path = require('path')
const readline = require('readline')
const { spawn } = require('child_process')
const rl = readline.createInterface({ input: process.stdin, terminal: false })
deployPath = 'C:/some/deploy/path'
deployBranch = 'master'
@foxxyz
foxxyz / post-receive
Created March 7, 2019 19:25
Python post-receive hook for Windows deployments
#!/usr/bin/env python3
# post-receive hook for git-push deployments on Windows
import sys
from os.path import join
from subprocess import call
deploy_path = 'C:\path\to\project'
deploy_branch = 'master'
@foxxyz
foxxyz / split.pl
Created April 7, 2018 00:36
Spitting iPhone X Portrait Mode Photos To Get Depth Data
#!/usr/bin/perl
# Running this script with the JPG file as the first argument should produce three images:
# - out1.jpg: The original color photo (4032x3024 px)
# - out2.jpg: A thumbnail of the original color photo (160x120 px)
# - out3.jpg: A grayscale depth map (768x576 px)
#
# Thanks to hfs's perl hex splitting script (https://stackoverflow.com/a/11293884)
#
undef $/;
$_ = <>;
@foxxyz
foxxyz / post-receive
Created March 16, 2017 22:33
Python post-receive hook
#!/usr/bin/env python3
# post-receive hook for git-push deployments
import sys
from subprocess import call
deploy_path = '/path/to/project/'
deploy_branch = 'master'
class Colors:
@foxxyz
foxxyz / nginx.conf
Last active March 3, 2024 10:42
Serve current directory via nginx
# Extremely basic development setup to serve the current directory at http://localhost:9001
# Start nginx in this directory with `nginx -p . -c nginx.conf`
# Stop nginx with `nginx -p . -s stop`
events {}
http {
# Serve files with correct mimetypes on OSX
# location may have to be adjusted depending on your OS and nginx install
include /usr/local/etc/nginx/mime.types;

Keybase proof

I hereby claim:

  • I am foxxyz on github.
  • I am ivoj (https://keybase.io/ivoj) on keybase.
  • I have a public key whose fingerprint is 1D45 A270 7E1A 108E AB41 8EEF 5C36 EDF6 24FF 7922

To claim this, I am signing this object:

@foxxyz
foxxyz / install.sh
Created July 30, 2014 01:30
Installing ffmpeg for OSX with ogv, webm and mp4 support
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc --with-theora --with-libogg
@foxxyz
foxxyz / post-receive
Last active December 21, 2015 18:29
Post-receive git hook for deploying remote repositories with a working tree.
#!/bin/sh
cd ..
GIT_DIR='.git'
git stash
umask 002 && git reset --hard && git submodule update --recursive
git stash pop
# Run compass to recompile
bash util/recompile_sass.sh