Skip to content

Instantly share code, notes, and snippets.

View paazmaya's full-sized avatar
:shipit:
Finding updates on my releases

Juga Paazmaya paazmaya

:shipit:
Finding updates on my releases
View GitHub Profile
@paazmaya
paazmaya / shave-sides-gm-jpg.sh
Last active August 2, 2017 09:08
Shave off (also known as cropping) sides from JPEG images with GraphicsMagick
#!/bin/bash
find . -maxdepth 2 -type f -iname '*.jpg' \
-exec sh -c '(cd $(dirname {}) && gm mogrify -shave 100x100 -auto-orient -preserve-timestamp {})' ';'
@paazmaya
paazmaya / image-optimise-guetzli.sh
Last active October 12, 2017 17:30
Find image files and optimise them with different command line tools
#!/bin/bash
# Find all JPEG files and do stuff with https://github.com/google/guetzli
find . -maxdepth 4 -type f -iname '*.jpg' \
-exec sh -c '(guetzli "{}" "{}.jpg")' ';'
@paazmaya
paazmaya / build.sh
Last active April 30, 2018 20:29
FFmpeg from source in Ubuntu
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
# Just enabling few important libraries, which are available in Ubuntu
# Also look at https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
./configure \
--prefix=/usr \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
@paazmaya
paazmaya / split-sprints.js
Last active November 13, 2018 10:36
Split single markdown file (list of sprints) to several (one for each sprint)
const fs = require('fs');
const MATCH_SPRINT = /^## Sprint (\d+):[\S\s]+?demo<\/a>/ugm;
const HEADER_LEVEL = /^##/ugm;
const SUFFIX = /\.md$/;
const original = fs.readFileSync('sprints-2018.md', 'utf8');
console.log(`Original file has ${original.length} lines`);
@paazmaya
paazmaya / setup.sh
Last active October 28, 2020 09:32
OCR with ocrmypdf in macOS, more than just English
# Install tools
# https://github.com/jbarlow83/OCRmyPDF
# https://github.com/tesseract-ocr/tesseract
brew install tessdata tesseract-lang ocrmypdf
# Not all language data and other important files install initially in the same place
cp /usr/local/Cellar/tesseract/4.1.1/share/tessdata/* /usr/local/Cellar/tesseract-lang/4.0.0/share/tessdata/
# Add to .bash_profile or run here before conversions
export TESSDATA_PREFIX=/usr/local/Cellar/tesseract-lang/4.0.0/share/tessdata/
@paazmaya
paazmaya / get-freds-scripts.js
Created March 19, 2021 22:57
Get all Fred's ImageMagick Scripts with Playwright
const fs = require('fs');
// https://www.npmjs.com/package/playwright
const {
firefox
} = require('playwright');
const FILE_DIR = __dirname + '/freds-scripts';
// Fred's ImageMagick Scripts
@paazmaya
paazmaya / .gitconfig
Created April 9, 2021 07:13
git config, the one that I use
# http://git-scm.com/docs/git-config.html
[user]
name = Juga Paazmaya
email = [email protected]
[github]
user = paazmaya
[ui]
@paazmaya
paazmaya / gitlab-repo-ssh-urls.js
Last active December 4, 2024 08:53
Get git clone commands from Gitlab repositories in your own profile page
// Copy these to the browser console. Using let instead of const to allow reassinging when its sometimes needed.
// Get a list of GitLab project URLs from a page
let list = document.querySelectorAll('.project-details h2 a');
let urls = Array.from(list).map(item => item.getAttribute('href'));
// Remove the leading / from the URLs and combine with SSH git URL
let ssh_git_urls = urls.map(item => item.replace(/^\//, '')).map(item => `[email protected]:${item}.git`);
// Add clone command to the URLs