Skip to content

Instantly share code, notes, and snippets.

Avatar
💧
Elixiring

Dylan Chong dylan-chong

💧
Elixiring
View GitHub Profile
@dylan-chong
dylan-chong / adguard
Created Mar 28, 2020
Adguard blacklist/block time-wasting feed pages
View adguard
/.*facebook.com\/$/
/.*reddit.com\/$/
/.*youtube.com\/$/
@dylan-chong
dylan-chong / download-songs-by-name.rb
Created Dec 28, 2019
Download a list of songs by name
View download-songs-by-name.rb
# Requires spotdl and youtube-dl to installed with python3
# Should be a list of search query text for spotify (e.g. `Song Name Artist Name`)
SONG_LIST_FILE = '/Users/Dylan/Desktop/songs.txt'.freeze
OUTPUT_FOLDER = '/Users/Dylan/Desktop/songs'.freeze
File.foreach(SONG_LIST_FILE) do |line|
command = [
'spotdl',
'--song',
@dylan-chong
dylan-chong / do-not-disturb-toggler-high-sierra.scpt
Last active Mar 29, 2019
do-not-disturb-toggler-high-sierra.scpt
View do-not-disturb-toggler-high-sierra.scpt
(* setDoNotDisturb function based on https://gist.github.com/Sanabria/40d80d84ec94644220489798f3aac930 *)
set workTimeLengthInSeconds to 60 * 10
set breakTimeLengthInSeconds to 60 * 1
on setDoNotDisturb(shouldBeOn)
(* Note 1: The 1 after menu bar may need to be changed to 2 when using multiple monitors *)
(* Note 2: For 10.11 and newer “NotificationCenter” is now spelled “Notification Center”*)
(* Note 3: The alert must be shown before toggling do not disturb mode, as doing the toggling requires pressing the option key, and we don't want to disturb the user's typing *)
tell application "System Events"
View Get_Safari12_Passwords from mrc-converter-suite.applescript
-- See the most up to date version here where it says "Download the mrc-converter-suite zip archive" https://discussions.agilebits.com/discussion/30286/mrcs-convert-to-1password-utility/p1
--
-- Exports Safari's saved passwords to a CSV file formatted for use with the convert_to_1p4's csv converter
--
-- Version 1.4
-- mike (at) cappella (dot) us
--
use AppleScript version "2.5" -- runs on 10.11 (El Capitan) and later
use scripting additions
@dylan-chong
dylan-chong / grab-options.sh
Created Jun 30, 2018
Grab --options from a help page
View grab-options.sh
#!/bin/bash
options_for_command() {
git help $1 \
| tr " " "\n" \
| egrep '^\--.*$' \
| egrep -v '/' \
| egrep -v '\-{3,}' \
| egrep -v '{|}' \
| perl -pe 's/\[=.*\]//' \
| perl -pe 's/[^\w=\n\[\]<>-]//' \
@dylan-chong
dylan-chong / update-preview.applescript
Created May 19, 2018
Open Preview.app so that it updates its view on the image then switch back to previous application
View update-preview.applescript
on run {input, parameters}
global currentProcess
tell application "System Events"
--set currentProcess to the name of the first process where it is frontmost
set currentProcess to (path to frontmost application as text)
end tell
activate application "Preview"
@dylan-chong
dylan-chong / autogen-plantuml.vim
Created May 13, 2018
Vim auto generate plantuml on save
View autogen-plantuml.vim
au BufWritePost *.plantuml :silent !plantuml % &
View aenea-spambot.py
import time
start = time.time()
def time_left():
global start
return 5 * 60 - (time.time() - start)
View run-uni-android.sh
git clone https://github.com/google/volley/
cd volley
need SYSfirst
need android
setenv ANDROID_HOME $ANDROID_SDK_HOME
# Now you have to open this android studio project, wait for it to finish loading, and then close it
./gradlew test
google-chrome build/reports/tests/testReleaseUnitTest/release/index.html
View personal-word-count.sh
wcme() {
NAME=`git config user.name`
git blame "$1" \
| egrep "\($NAME" \
| egrep -v '<!--' \
| perl -pe 's/.*\d+\)(.*)/\1/' \
| wc -w
}
wcme file.md # => 123