Skip to content

Instantly share code, notes, and snippets.

View Fintan's full-sized avatar

Fintan Fintan

View GitHub Profile
@Fintan
Fintan / batch-optimise-images
Last active June 15, 2022 08:10
Use Imagemagick to resize and set quality of all jpegs in a directory, copying to a sub-directory (xyz)
magick mogrify -path xyz -quality 82 -resize 512x512 *.jpg
@Fintan
Fintan / gist:6ff68799d269c3e377ed5f80ad11e013
Created July 25, 2020 12:21
Create an icon file with Inkscape and ImageMagick
#1) Export your SVG to PNG with InkScape
#2) Resize this PNG image to the sizes you want with ImageMagick
#3) Convert the PNG images to ICO
#4) Make sure your ICO contains everything
magick convert master.png -resize 16x16 16.png
magick convert master.png -resize 32x32 32.png
magick convert master.png -resize 48x48 48.png
magick convert 16.png 32.png 48.png icon.ico
@Fintan
Fintan / gist:2c480c231b48c313edcd73a539e48399
Created July 25, 2020 12:20
1) Export your SVG to PNG with InkScape 2) Resize this PNG image to the sizes you want with ImageMagick:
magick convert master.png -resize 16x16 16.png
magick convert master.png -resize 32x32 32.png
magick convert master.png -resize 48x48 48.png
magick convert 16.png 32.png 48.png icon.ico
identify icon.ico
@Fintan
Fintan / delete.txt
Last active January 15, 2020 10:04
List and kill processes
The most common kill signals are:
Signal Name. Single Value. Effect
SIGHUP 1 Hangup
SIGINT 2 Interrupt from keyboard
SIGKILL 9. Kill signal
@Fintan
Fintan / hex.js
Last active December 13, 2019 09:58
get hexadecimal string from a css var
// see https://codesandbox.io/s/epic-cherry-p6hw0
const computedStyle = getComputedStyle(document.documentElement);
const primaryColour = computedStyle.getPropertyValue("--primary-colour").trim(); // outputs #00ff00
@Fintan
Fintan / Dockerfile
Created December 11, 2019 10:05
Run MongoDB in a Docker container
FROM debian:jessie-slim
RUN apt-get update && \
apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0C49F3730359A14518585931BC711F9BA15703C6 && \
gpg --export $GPG_KEYS > /etc/apt/trusted.gpg.d/mongodb.gpg
ARG MONGO_PACKAGE=mongodb-org
ARG MONGO_REPO=repo.mongodb.org
ENV MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO}
ENV MONGO_MAJOR 3.4
//User Timing API (gets included in Lighthouse json output)
// https://developers.google.com/web/tools/lighthouse/
// https://www.html5rocks.com/en/tutorials/webperformance/usertiming/
window.performance.mark('mark_before_createWidget');
createWidget();
window.performance.mark('mark_after_createWidget');
window.performance.mark('mark_before_createWidget');
createWidget();
window.performance.mark('mark_after_createWidget');
window.performance.measure('mark_before_createWidget', 'mark_after_createWidget');
git init
touch initial.txt
git add initial.txt
git commit -m 'initial commit'
git remote add -f shorttxt git@bitbucket.org:hmheng/cpl_short_text_table.git
git merge shorttxt2/master --allow-unrelated-histories
git mv -k * ./shorttxt/
#investigate this because -k is not desirable
@Fintan
Fintan / add-empty-at-camera.py
Created February 24, 2019 15:24
Add empty at viewport camera location
import bpy
def get3dViewport():
for a in bpy.context.window.screen.areas:
if a.type == 'VIEW_3D':
print('this ones the 3d viewport')
viewport = a;
return viewport;
# create a cameras collection if it doesn't already exist