Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE
0xBADC0FFEE / Info.plist
Last active May 20, 2020 — forked from mfilej/Info.plist
Make Safari open links from other applications in current space
View Info.plist
<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 Mar 25, 2019
Homebrew packages tree of deps
View brewlist.sh
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 Oct 9, 2018 — forked from tmehlinger/run.sh
gstreamer RTP to RTMP
View run.sh
#!/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 Sep 5, 2018
Hide annoying play button in center in Google Chrome
View fix-chrome-player.css
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
Bash script that remove oldest files recursively from a directory if free size is over a threshold
View remove_oldest_to_free_space.sh
#!/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 Aug 15, 2017
Get diff between two directories using rsync
View rsync-diff.sh
rsync -rcnC --out-format="\"%f\"" folder1/ folder2/ | xargs cp --parents -rfvt folder3/
View homebrew-list-deps-tree.sh
brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done
View setup-key-over-ssh.sh
# 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"
You can’t perform that action at this time.