Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE
0xBADC0FFEE / Info.plist
Last active May 20, 2020 20:47 — forked from mfilej/Info.plist
Make Safari open links from other applications in current space
<key>CFBundleIdentifier</key>
<string>com.apple.AppleScript.SafariURLHelper</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>SafariURLHelper</string>
<key>CFBundleURLSchemes</key>
<array>
<string>http</string>
@0xBADC0FFEE
0xBADC0FFEE / brewlist.sh
Created March 25, 2019 09:44
Homebrew packages tree of deps
brewlist () {
if tput setaf 1 &> /dev/null
then
reset=$(tput sgr0)
blue=$(tput setaf 33)
else
reset="\e[0m"
blue="\e[1;34m"
fi
brew leaves | while read bfile
@0xBADC0FFEE
0xBADC0FFEE / run.sh
Last active October 9, 2018 12:14 — forked from tmehlinger/run.sh
gstreamer RTP to RTMP
#!/bin/bash
# tested on Ubuntu 16.04
apt-get install -y \
gstreamer1.0-libav \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-tools
@0xBADC0FFEE
0xBADC0FFEE / fix-chrome-player.css
Created September 5, 2018 10:30
Hide annoying play button in center in Google Chrome
video::-webkit-media-controls-overlay-play-button {
display: none;
}
video::-webkit-media-controls-play-button {
display: flex !important;
}
@0xBADC0FFEE
0xBADC0FFEE / remove_oldest_to_free_space.sh
Created May 18, 2018 12:09
Bash script that remove oldest files recursively from a directory if free size is over a threshold
#!/bin/bash
DIRECTORY="/path/to/your/directory"
CAPACITY=95
while [[ $(df $DIRECTORY | awk 'NR==2 && gsub("%","") {print$5}') -ge $CAPACITY ]];do
rm -rf $(find $DIRECTORY -mindepth 1 -printf '%T+ %p\n' | sort | awk 'NR==1 {print$2}')
done
@0xBADC0FFEE
0xBADC0FFEE / rsync-diff.sh
Created August 15, 2017 10:09
Get diff between two directories using rsync
rsync -rcnC --out-format="\"%f\"" folder1/ folder2/ | xargs cp --parents -rfvt folder3/
brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
@0xBADC0FFEE
0xBADC0FFEE / setup-key-over-ssh.sh
Last active November 3, 2016 13:40
Set Up SSH Keys
# local
cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
# remote
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# both
cat ~/.ssh/id_rsa.pub | ssh user@ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"
ssh login@hostname -t 'tmux -CC'