This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-open-url='git remote -v | grep fetch | grep -oE '\''https://github.com/\S+'\'' | xargs -I{} open {}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaultBoldFontName | |
defaultDimmedTextColor | |
defaultEmphasizedFontName | |
defaultFontName | |
defaultSelectedTextShadowColor@1x | |
defaultSelectedTextShadowColor@2x | |
defaultShadowOffset | |
defaultTextColor | |
defaultTextShadowColor | |
defaultTextShadowColor@2x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias_stats() { | |
local search="$1" | |
list=""; for c in $(alias | grep "$search" | cut -d'=' -f1); do count=$(grep -Ec ";$c" ~/.zsh_history); list="${list}\n${count} ${c}"; done; echo -e $list | sort -n | grep -Ev "^0" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$websites = [ | |
["uid" => "mywebsite01", "name" => "mywebsite01.dev", "alias"=>"www.mywebsite01.dev", "root" => "/var/www/mywebsite01/www"], | |
["uid" => "mywebsite02", "name" => "mywebsite02.dev", "alias"=>"", "root" => "/var/www/mywebsite02/www"] | |
]; | |
$template = | |
" nxv__UID_: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Format a float value with desired numbers after the comma to a string. Doesn't display the comma if the number is a round value. | |
import Foundation | |
extension Double { | |
func toDecimalString(decimals: Int = 0) -> String { | |
let format = (self % 1 > 0 && decimals > 0) ? "%.\(decimals)f" : "%.0f" | |
return String(format:format, self) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let seconds = 86400*4 + 3600*2 + 65 | |
print(String((seconds / 86400)) + " days") | |
print(String((seconds % 86400) / 3600) + " hours") | |
print(String((seconds % 3600) / 60) + " minutes") | |
print(String((seconds % 3600) % 60) + " seconds") |