Skip to content

Instantly share code, notes, and snippets.

View julesjans's full-sized avatar

Jules Jans julesjans

View GitHub Profile
@julesjans
julesjans / web-video-converter.sh
Last active October 12, 2016 21:24
Converts video (mp4/m4v) into web mp4 & ogv, requires ffmpeg & exiftool
#!/bin/sh
# VIDEO Conversion Tool
# Takes a source directory, and converts for the web into an output directory
# Arguments: src, dest
# Set the title of the source file
# for f in "${1%/}"/*.{mp4,m4v}
# do
# filename=$(basename "$f")
@julesjans
julesjans / apple-app-icons.sh
Last active October 19, 2016 09:58
Takes an icon PNG as an argument, uses sips (macOS) or convert (ImageMagick), makes a lot of icons!
#!/bin/bash
# Takes an icon PNG as an argument, uses sips (macOS) or convert (ImageMagick), makes a lot of icons!
input_file=$1
sizes=(20 29 40 50 57 60 72 76 83.5 512)
scales=(1 2 3)
for size in "${sizes[@]}"
do
for scale in "${scales[@]}"
@julesjans
julesjans / date-images.sh
Created November 17, 2016 10:45
Renames images according to their date
#!/bin/bash
#
# Image renaming script, requires exiftool
for f in "${1%/}"/*.{jpg,jpeg}
do
if [ -f "$f" ]
then
echo "Preparing $f"
filename=$(basename "$f")
@julesjans
julesjans / date-images.sh
Created November 17, 2016 10:45
Renames images according to their date
#!/bin/bash
#
# Image renaming script, requires exiftool
for f in "${1%/}"/*.{jpg,jpeg}
do
if [ -f "$f" ]
then
echo "Preparing $f"
filename=$(basename "$f")
@julesjans
julesjans / ioslocaleidentifiers.csv
Created February 17, 2017 15:37 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@julesjans
julesjans / vat_calc.rb
Created August 17, 2017 08:05
Calculating VAT
module VatCalc
def VatCalc.vat_rate
@vat_rate ||= BigDecimal.new('20')
end
def VatCalc.vat_rate=(value)
@vat_rate = BigDecimal.new(value.to_s)
end
@julesjans
julesjans / auction_prices.rb
Last active August 17, 2017 10:31
Calculating hammer price to limit on auction with variable commission rates
BEFORE = 0.25 # Percent commission before the limit
LIMIT = 50000 # The commission boundary
AFTER = 0.20 # Percent after the boundary
# The only number to change is this one! No spaces, dots or commas...!
total_price_including_commssion = 10000000
# Warning - Do not use for bids over a £1,000,000 Hammer
@julesjans
julesjans / time-conversions.swift
Created August 17, 2017 10:32
Handle time conversions from .NET APIs
import Foundation
// Further Reading:
// https://technet.microsoft.com/en-us/library/aa258277(v=sql.80).aspx
// http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns
// http://www.w3.org/TR/NOTE-datetime
@julesjans
julesjans / remove-from-git.sh
Created August 18, 2017 10:40
Remove a file from GIT history
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_TO_DELETE' --prune-empty --tag-name-filter cat -- --all
@julesjans
julesjans / compress.sh
Last active August 18, 2017 10:50
Compress a file/directory using hdiutil and tar
#!/bin/bash
hdiutil create -fs HFS+ -srcfolder "$1" -volname "$(basename $1)" "$1.dmg"
tar -cjf "$1.tar.bz2" -C "$(dirname $1)" "$(basename $1)"