Skip to content

Instantly share code, notes, and snippets.

@avielsh
avielsh / tmux-mouse.md
Last active February 6, 2019 18:42
A simple hack to toggle mouse on/off for easier clipboard functionality #tmux

Tmux bind m to toggle mouse on/off

Run this on terminal to add to your .tmux.conf:

cat - <<-EOF
#bind m to Enable/Disable mouse (change to whatever you fancy)
bind m if-shell 'tmux show-options -vg mouse | grep on' \
"set -g mouse off \; display \"Mouse is off\"" \
"display \"Mouse is on\" \; set -g mouse on"
EOF &gt;&gt; ~/.tmux.conf
@avielsh
avielsh / test_inet
Last active April 10, 2020 08:07
A simple internet connectivity test script
#!/usr/bin/env zsh
#!/usr/bin/env bash
#Configure these as needed
host="google.com"
ping="ping -c1 -W1000 $host > /dev/null"
#Status update interval (In seconds)
statusinterval=300
dndstart="23:50"
dndend="09:30"
#reset wifi script - change this for a quick connection fix
@avielsh
avielsh / .zshrc
Last active December 24, 2019 11:37
Simple searchable database a la locate - but much faster and using fzf for selection
#Add this to your .zshrc to search using gl [options] <Search query>
#gl takes a few optional arguments. By default, if gl is not being piped, after selection of file(s) you could cd to it's directory,
#edit with vim, copy to clipboard or open in finder.
#File extentions: aud(io), zip, doc, vid(eo), pic(tures). Searching for all videos: "gl vid". Searching for "matrix" in videos: "gl vid matrix"
#Starting search from current directory: "gl ."
#Search in home directory: "gl adm"
#Search in downloads directory: "gl dl"
#Search for a suffix: "gl -s <suffix>"
#Search for full filename: "gl -f <filename>"
#This script uses fd,rg and fzf, so make sure you have them.
@avielsh
avielsh / backup.zsh
Created December 24, 2019 11:41
My simple workspace dir backup
#!/usr/local/bin/zsh -l
echo "$(date) - start - $(basename $0)"
cd ~ || return
BACKUPLIST=~/backuplist
BACKUPDIR=~/Downloads/Backup
WORKSPACE=$BACKUPDIR/workspace.tgz
TARGET=/Volumes/j\$/Apps/Mac
IN=( dotfiles iTerm2-Color-Schemes mac-cli mathias Menlo-for-Powerline node_modules Notes paulirish skwp "Library/Application Support" Library/Preferences Library/Safari Documents/Alfred "Calibre Library" Library/QuickLook Library/Containers Library/PreferencePanes workspace/test_inet)
EX=('Cask' 'Dash' 'Google' 'Code' 'CrossOver' 'Spotify' '.npm' 'Firefox' 'Code' 'com.docker.docker' 'Plex Media Server' 'com.rockysandstudio.Leaf')
@avielsh
avielsh / goog.sh
Created January 31, 2020 23:02
Search google from the cli. the simplest script possible!
#Search in google for whatever arguments. if no arguments use the clipboard
goog() {
url='https://www.google.com/search?q='
for i in "$@"
do
open "${url}${i}"
done
if [[ $# -eq 0 ]];
then
@avielsh
avielsh / GoogleMaps.js
Last active May 6, 2020 14:48
Return distance and duration between two addresses
/**
* Get Distance between 2 different addresses.
* @param start_address Address as string Ex. "בורגשוב 35, תל אביב"
* @param end_address Address as string Ex. "הקישון 140,תל אביב"
* @param ret Return type as string Ex. "km" or "duration". default is both
* @customfunction
*/
function GOOGLEMAPS(start_address,end_address,ret) {
// start_address = "Tel aviv";