Skip to content

Instantly share code, notes, and snippets.

0xBADC0FFEE

Block or report user

Report or block 0xBADC0FFEE

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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"
@0xBADC0FFEE
0xBADC0FFEE / scp
Created Sep 3, 2013
Постоянно забываю как копировать по ssh
View scp
scp -r -C root@re.mo.te.host:/path/to/directory /local/path
# копировать с удаленного хоста к себе
# -r с вложенными директориями
# -С с компрессией
View chanin-async-loop.js
var promise = $q.all(null);
angular.forEach(urls, function(url){
promise = promise.then(function(){
return $http({
method: 'GET',
url:url
}).then(function(res){
$scope.responses.push(res.data);
});
View async-js-files.js
(function() {
"use strict";
function loadJSAsync() {
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "script.js";
js.async = true;
// insert the "js" script tag to the DOM here ...
}
if (window.attachEvent) {
You can’t perform that action at this time.