Skip to content

Instantly share code, notes, and snippets.

@atika
atika / verify_programs.sh
Last active October 22, 2018 04:19
Verify if programs exits on system before executing a shell script
verify_programs() {
local programs="$1"
local ccyan="\\033[1;36m"
local cnormal="\\0033[0;39m"
abort=0
for p in $programs; do
type $p >/dev/null 2>&1 || { echo -e >&2 " ${ccyan}${p}${cnormal} required but it's not installed. Aborting."; abort=1; }
done
if [[ $abort -eq 1 ]]; then
exit 1;
@atika
atika / LaunchBar-Theme-Arguments.txt
Last active July 6, 2023 08:40
A non exhaustive list of LaunchBar theme arguments, extracted with grep from bundled themes, to make your custom themes.
defaultBoldFontName
defaultDimmedTextColor
defaultEmphasizedFontName
defaultFontName
defaultSelectedTextShadowColor@1x
defaultSelectedTextShadowColor@2x
defaultShadowOffset
defaultTextColor
defaultTextShadowColor
defaultTextShadowColor@2x
@atika
atika / github-open-url.sh
Created October 21, 2015 08:34
Alias to open a GitHub URL from a Git Repo
github-open-url='git remote -v | grep fetch | grep -oE '\''https://github.com/\S+'\'' | xargs -I{} open {}'
@atika
atika / pushover
Last active October 20, 2023 19:37
Send a pushover notification from Bash
#!/bin/bash
# ./pushover.sh -t "Pushover via Bash" -m "Pushover message sent with bash from $(hostname -f)" -p1 -s siren -u http://www.google.com -n "Google"
USER_TOKEN=YOUR_USER_TOKEN_HERE
# YOUR APPS TOKENS / UPPERCASE NAME WITH _TOKEN (usage: "-a monitor" uses MONITOR_TOKEN)
MONITOR_TOKEN=APP_TOKEN
BACKUP_TOKEN=APP_TOKEN
ALERT_TOKEN=APP_TOKEN
APP_LIST="monitor, backup, alert" # FOR USAGE
@atika
atika / split_quicktime_movie.scpt
Created May 22, 2015 10:15
Split a QuickTime video in multiple part (set cut mark in seconds)
# Split and export a QuickTime Movie
# Create a folder "exports" on the desktop
# Open one movie file in QuickTime
# Configure where you want to cut the video, if you want first and last part and the QuickTime window name (after modification)
# Launch this script and wait
#------------- BEGIN OF CONFIGURATION --------
-- Middle Mark : Set where you want to cut the video (in seconds)
@atika
atika / checkisup
Created April 4, 2015 10:01
Check until host is up using PING
# Check until host is UP
checkisup () { while (true) do if ping -t 2 -c 1 $1 &>/dev/null; then echo -e " $(date +%T) \\033[1;36m Host $1 is up! \\033[0m\n $(ping -c 1 $1 | head -n2 | tail -n1)"; return 0; else echo -e " $(date +%T) \\033[31m Host $1 is down...\\033[0m"; sleep 1; fi; done; }
@atika
atika / apache-selfsigned-cert-gen.sh
Last active August 29, 2015 14:13
Self-Signed Certificate for Apache
#!/bin/bash
servername=$(echo "$@" |sed 's/ /-/g')
if [ "$servername" == "" ]; then
echo "Please specify a server name like: myserver.com"
exit
fi
if [ -f "$servername.key" ] || [ -f "$servername.crt" ]; then
@atika
atika / git-sync-upstream.sh
Created December 23, 2014 20:11
Update a GitHub Forked Repository with his Upstream/Master (and update remote master)
#!/bin/bash
# usage: git-sync-upstream "/your/git/folder/" [rebase/merge]
action="merge"
if [ $# -ge 1 ]; then cd "$1"; fi
if [ $# -eq 2 ]; then if [ "$2" = "rebase" ]; then action="rebase"; fi; fi
clear;
@atika
atika / osx_set_app_category.sh
Last active September 29, 2018 03:40
Set the missing app category on OS X
#!/bin/bash
# Write category for an app
developer="public.app-category.developer-tools"
utilities="public.app-category.utilities"
productivity="public.app-category.productivity"
photography="public.app-category.photography"
video="public.app-category.video"
music="public.app-category.music"
@atika
atika / dropzone.sublime-snippet
Created November 10, 2014 20:42
Dropzone 3 action snippet for Sublime Text
<snippet>
<content><![CDATA[
# Dropzone Action Info
# Name: ${1:Name}
# Description: ${2:Description}
# Handles: ${3:Files, Text}
# Creator: ${4:Creator Name}
# URL: ${5:Creator URL}
# OptionsNIB: ${6:Login, ExtendedLogin, APIKey, UsernameAPIKey, ChooseFolder, ChooseApplication, GoogleAuth}
# LoginTitle: ${7:Login Title (For Login NIB)}