Skip to content

Instantly share code, notes, and snippets.

@jnx
jnx / Exiftool Canonize
Created Feb 23, 2021 — forked from jmuspratt/Exiftool Canonize
exiftool : rename files in current dir to YYYY-MM-DD-HH-MM-SS-1.ext
View Exiftool Canonize
# Rename image and MOV files according to EXIF capture date, using YYYY-MM-DD-HH-MM-SS.ext
format.
# Files shot within the same second get copy number added (-1,-2, etc.).
# Video files require a different, so we run exiftool 3 times:
# 1. Exclude MOV files and rename the image files with <CreateDate>.
# 2. Target MOV files and rename them with MediaCreateDate (for iPhone videos).
# 3. Target MOV files and rename them with DateTimeOriginal (for Fuji camera videos).
# Requirements: install the package manager Homebrew (http://brew.sh), then install exiftool (type brew install exiftool in Terminal.app).
# Now open Terminal.app, cd to the relevant directory, and run the command.
@jnx
jnx / express_in_electron.md
Created Oct 15, 2018 — forked from maximilian-lindsey/express_in_electron.md
How to run Express inside an Electron app
View express_in_electron.md

How to run Express inside an Electron app

You can run your Express app very easily inside your Electron app.

All you need to do is to:

  • place all the files of your Express app inside a new app folder in your_electron_app\resources\app
  • reconfigure the app.js file
  • refactor some relative pathes in your Express app
@jnx
jnx / nginx-config.conf
Created Jan 3, 2018 — forked from konovalov-nk/nginx-config.conf
Useful nginx SSL hardened (letsencrypt) config for setting up Rails application with Puma webserver
View nginx-config.conf
upstream myappdev {
server unix:///home/your_user/git/dev.your.website.com/shared/sockets/puma-dev.sock;
}
# don't forget to add this to server {..} block
# add_header X-Xss-Protection "1; mode=block";
server {
listen 80;
listen 443 ssl http2;
@jnx
jnx / recursive-division.rb
Created Nov 9, 2017 — forked from jamis/recursive-division.rb
An implementation of the "Recursive Division" algorithm for maze generation.
View recursive-division.rb
# --------------------------------------------------------------------
# An implementation of the "Recursive Division" algorithm. This is a
# kind of fractal maze algorithm, recursively dividing the maze into
# smaller and smaller cells. This algorithm stops at the integer
# boundary, but theoretically the algorithm could continue infinitely
# to smaller and smaller scales.
#
# Note that this algorithm is implemented as a "wall adder", rather
# than a "passage carver", so the meaning of the bits in each cell
# is reversed: instead of the S bit (for instance) meaning "a passage
@jnx
jnx / README.md Getting some equivalent of pow.cx using nginx and dnsmasq on non-Apple *NIX
View README.md

Install nginx and dnsmasq

Using apt-get/dnf/pkg_add/ports/rpm/pacman/whatever...

Add necessary config files

/etc/dnsmasq.d/dev

# /etc/dnsmasq.d/dev
@jnx
jnx / git_aliases.zsh
Created Sep 13, 2016
git and git-flow aliases
View git_aliases.zsh
# GIT / GIT FLOW ALIASES
alias gft="git fetch --tags"
alias gpt="git push --tags"
alias gcm="git checkout master"
alias gmm="git merge master"
alias gcd="git checkout develop"
alias gmd="git merge develop"
gcf() { git checkout feature/$1; }
View new_invitation.html.erb
<!-- /app/views/admin/users/new_invitiations.html.erb -->
<h2>Send invitation</h2>
<%= form_for @user, :url => send_invitation_admin_users_path do |f| %>
<table style='width: 50%'>
<tr>
<td><%= f.label :first_name %></td>
<td><%= f.text_field :first_name %></td>
View add.js.erb
<tr>
<td><%=@key.split(".").drop(1) %></td>
<td><%= @value%></td>
</tr>
View spec_helper.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'action_controller/test_case'
require 'miniskirt'
require 'capybara/rails'
View gist:6409792
function precmd() {
if command git rev-parse --git-dir > /dev/null 2>&1; then
window_label=$(git rev-parse --show-toplevel)
tab_label=$(echo $window_label | awk -F\/ '{print "[git] " $NF}')
else
window_label=${PWD/${HOME}/\~}
tab_label=$window_label
fi
echo -ne "\e]2;${window_label}\a"
echo -ne "\e]1;${tab_label: -24}\a"