Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeriel Jan del Prado jerieljan

View GitHub Profile
@jerieljan
jerieljan / btt-screenshot.sh
Created May 22, 2021
Screenshot OCR with BetterTouchTool on MacOS
View btt-screenshot.sh
#!/usr/bin/env bash
# Usage:
# - Install `tesseract` with `brew install tesseract`
# - In BetterTouchTool, create a trigger of your choice.
# (I recommend a Keyboard Shortcut with Cmd+Shift 6)
# - Add an Execute Shell Script / Task action
# - Paste this script.
# NOTE: You'll need to authorize BTT to the Screen Recording permission in Security and Privacy at System Preferences
@jerieljan
jerieljan / Test.kt
Created Mar 6, 2019
Jackson + Kotlin makes easy work with JSON.
View Test.kt
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
/**
*
*
* Date: 2019-03-05
* Time: 11:03 AM
* @author jerieljan
*/
@jerieljan
jerieljan / Smarter-Better-Diagrams.md
Last active Dec 12, 2018
This quick little guide lets you export and share vector diagrams that can be panned, zoomed and loads custom fonts from the web, like Google Fonts. Perfect for sharing detailed diagrams to people without compromising quality and convenience.
View Smarter-Better-Diagrams.md

Sharing Smarter and Better Diagrams

Exporting diagrams and sharing them is just business as usual; especially if it comes in PNG or JPG.

But what if you could make them better?

Well, yeah, you can by exporting them to a vector format like SVG or a PDF document. That way, details are drawn in 2D points and math and won't lose any detail if you zoom in.

@jerieljan
jerieljan / How I Do PlantUML.md
Last active Sep 13, 2021
PlantUML with Style -- How I do PlantUML
View How I Do PlantUML.md

I use PlantUML a lot. It's what I use for drawing all sorts of diagrams and it's handy because of its easy markup (once you get used to it) while making things easy to maintain as projects grow (thanks to version control)

This gist explains how I do my PlantUML workspace in a project.

  • The idea is to keep a globals directory for all diagrams to follow (like the "stylesheet" below) to keep things consistent.
  • I use a stylesheet.iuml file that keeps the use of colors consistent through use of basic FOREGROUND, BACKGROUND and ACCENT colors.
  • The style-presets.iuml file defines these colors so you can make "presets" or "themes" out of them.
  • As stated in the stylesheet.iuml, you'll need the Roboto Condensed and Inconsolata fonts for these to work properly.
  • You can choose to either run the PlantUML jar over your file/s, or use an IDE like VSCode with the PlantUML extension. Here's a preview of example-sequence.puml for example: https://imgur.com/Klk3w2F
@jerieljan
jerieljan / archive-lepton.sh
Created Apr 10, 2017
A simple script for processing a directory of PNG images converted to JPG and compressed to Lepton and renamed into a sequence while retaining the modification dates.
View archive-lepton.sh
#!/bin/bash
# This simple script processes screenshots taken with a PS3 and does multiple things:
# - Changes all PNG files to JPG using imagemagick
# - Compresses all files into Lepton-format images
# - Reapplies the original modification date for metadata retention.
# Prepare a file list, sorted by modification date.
rm FILELIST 2>/dev/null
ls -tdr1 *.png > FILELIST;
@jerieljan
jerieljan / ps3shot.sh
Created Nov 17, 2016
A simple script for processing screenshots taken with a PS3. Images are cropped (custom for me, edit it to fit your needs), files are renamed and modification dates are retained in a correct sequence.
View ps3shot.sh
#!/bin/bash
# This simple script processes screenshots taken with a PS3 and does multiple things:
# - Crops the image to a preferred size (this depends on the game used, remove if desired, or adjust as needed.)
# - Renames all images by sequence, sorted by modification date (dates are copied to the new files)
# Prepare a file list, sorted by modification date.
rm FILELIST 2>/dev/null
ls -tdr1 *.png > FILELIST;
View keybase.md

Keybase proof

I hereby claim:

  • I am jerieljan on github.
  • I am jerieljan (https://keybase.io/jerieljan) on keybase.
  • I have a public key whose fingerprint is 224A 1D88 3F54 5C91 A38A A510 A910 0D93 19EF 97BA

To claim this, I am signing this object:

@jerieljan
jerieljan / splice-video.sh
Last active Aug 7, 2016
This simple script splices a video file "trimmed.mkv" into multiple videos--defined by X-count and Y-count of screens. Requires ffmpeg.
View splice-video.sh
#!/bin/bash
# This script splices a movie file into multiple parts.
# First parameter for the number of X screens
# Second parameter for the number of Y screens
X_COUNT=$1
Y_COUNT=$2
FILENAME="trimmed.mkv"
@jerieljan
jerieljan / simple-sync
Last active Aug 29, 2015
A simple shell script that consistently observes a directory and synchronizes its contents when changes are found, using rsync's one-way sync.
View simple-sync
#!/bin/sh
## A simple shell script that consistently observes a directory and synchronizes its contents when changes are found, using rsync's one-way sync.
## Most of the heavy lifting is really done by rsync, so what this script provides is just convenience over cron, notifications (if you have notify-pb) and rsync not being spammed by said cron job through a simple lockfile.
## simple-sync requires rsync, notify-pb (Pushbullet) and preferably run by a scheduler such as cron.
# Core variables
SYNC_HOME='/home/user'
SYNC_SOURCE='user@server.com:/path/to/source/*'
SYNC_DESTINATION="${SYNC_HOME}/path/to/destination/"
@jerieljan
jerieljan / manage-dir.sh
Last active Aug 29, 2015
Manage directories' files using a simple shell script! This script simply relocates files from a base directory to a subdirectory based on its file format.
View manage-dir.sh
#!/bin/bash
# A basic directory management script file.
# Add this to incron via incrontab -e with the IN_CLOSE_WRITE and IN_MOVED_TO flag.
# Usage: manage-dir.sh <file-to-process> <base-directory>
INCOMING="$1"
BASE_DIR="$2"
SUBFOLDER=""
ICON="/usr/share/icons/gnome/32x32/actions/document-save-as.png"