Skip to content

Instantly share code, notes, and snippets.

View christopheranderton's full-sized avatar

Christopher Anderton christopheranderton

View GitHub Profile
@jacobsalmela
jacobsalmela / convertDOCXtoPDF.sh
Last active July 18, 2023 18:14
Converts a DOC or DOCX to a PDF with a right-click
#!/bin/bash
# Jacob Salmela
# 2016-03-12
# Convert annoying DOCX into PDFs with a right-click
# Run this as an Automator Service
###### SCRIPT #######
for f in "$@"
do
# Get the full file PATH without the extension
# "Colorizing B/W Movies with Neural Nets",
# Network/Code Created by Ryan Dahl, hacked by samim.io to work with movies
# BACKGROUND: http://tinyclouds.org/colorize/
# DEMO: https://www.youtube.com/watch?v=_MJU8VK2PI4
# USAGE:
# 1. Download TensorFlow model from: http://tinyclouds.org/colorize/
# 2. Use FFMPEG or such to extract frames from video.
# 3. Make sure your images are 224x224 pixels dimension. You can use imagemagicks "mogrify", here some useful commands:
# mogrify -resize 224x224 *.jpg
# mogrify -gravity center -background black -extent 224x224 *.jpg
@retrography
retrography / define.py
Created December 31, 2015 08:24
Uses OSX Dictionary API Python bindings to fetch dictionary definition of a word (and colorizes it)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import re
from DictionaryServices import *
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
@marcinczenko
marcinczenko / Open in new iTerm2 window
Created December 31, 2015 04:05
Automator: opens the folder in a new iTerm2 window.
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
-- https://gist.github.com/eric-hu/5846890
-- Modified to work with files as well, cd-ing to their container folder
-- Modified to do an ls -l if the selected item in Finder is a file so that you get the name of the file waiting for you in the terminal.
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
@himenlinamarbric
himenlinamarbric / spotifyHijack.scpt
Last active June 21, 2025 14:18
Audio Hijack Pro & Spotify -- No Polling
-- Usage
-- 1. Edit the settings (see below). This step is NECESSARY the first time you use it!
-- 2. Run this script (this should open Audio Hijack Pro and Spotify)
--
-- NOTE: the script assumes that each track is played entirely. You CANNOT skip tracks in Spotify.
-- If you do so the script will get out of sync and the resulting files contain partial or multiple songs.
-- You can abort a recordig session by stopping this script and ending (manually) the recording
-- in Audio Hijack Pro.
--
-- You need to have "atomicparsley" installed on your system. You can install the application with
@gohoyer
gohoyer / progressbar.sh
Last active November 6, 2017 10:54 — forked from stevenrombauts/progressbar.sh
Bash Progress Bar
#!/bin/bash
# Slick Progress Bar
# Created by: Ian Brown ([email protected])
# Please share with me your modifications
# Note: From http://stackoverflow.com/questions/11592583/bash-progress-bar
# Functions
PUT(){ echo -en "\033[${1};${2}H";}
DRAW(){ echo -en "\033%";echo -en "\033(0";}
WRITE(){ echo -en "\033(B";}
HIDECURSOR(){ echo -en "\033[?25l";}
var DEFAULT = "DIRECT";
var proxy = "SOCKS5 127.0.0.1:9909";
var domains = {
"moe.fm": 1,
"moe.org": 1,
"miui.com": 1,
"xiaomi.com": 1,
"webhek.com": 1,
"icourse163.org": 1,
@nicolaballotta
nicolaballotta / cloud.sh
Created October 23, 2015 15:07
Switch on/off iCloud sync service
#!/bin/bash
function cloudOn {
launchctl load /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
launchctl load /System/Library/LaunchAgents/com.apple.nsurlsessiond.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.nsurlsessiond.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.nsurlstoraged.plist
}
function cloudOff {
@dardo82
dardo82 / automator2shell.sh
Last active November 13, 2016 21:28
Automator to SH script
#!/bin/zsh
# Convert Apple Automator "Run Shell Script" action to actual shell script
NAME="${${1##*/}%.*}.sh"
CDWF="$1/Contents/document.wflow"
touch $NAME
chmod +x $NAME
awk -F'<|>' '/bin\/.*sh/{print "#!"$3; exit}' $CDWF > $NAME
@korya
korya / Login shell vs Subshell.md
Last active December 21, 2024 01:51
.bashrc vs .bash_profile

.profile, .bash_profile, .bashrc. The Long Story.

Traditionally, when you log into a Unix system, the system would start one program for you. That program is a shell, i.e., a program designed to start other programs. It's a command line shell: you start another program by typing its name. The default shell, a Bourne shell, reads commands from ~/.profile when it is invoked as the login shell.

Bash is a Bourne-like shell. It reads commands from ~/.bash_profile when it is invoked as the login shell, and if that file doesn't exist¹, it tries reading ~/.profile instead.