Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabio Yamate fabioyamate

View GitHub Profile
@fabioyamate
fabioyamate / mover
Last active Feb 8, 2022
unRAID mover script
View mover
#!/bin/bash
# This is the 'mover' script used for moving files from the cache disk to the
# main array. It is typically invoked via cron.
# After checking if it's valid for this script to run, we check each of the top-level
# directories (shares) on the cache disk. If, and only if, the 'Use Cache' setting for the
# share is set to "yes", we use 'find' to process the objects (files and directories) of
# that directory, moving them to the array.
@fabioyamate
fabioyamate / sr.bash
Created Apr 26, 2012
Replacing string in with sed
View sr.bash
# replaces all string matches in files
#
# USAGE:
# sr $from $to
# sr $from $to $type
#
# Arguments:
# $from - from value
# $to - to value
# $type - file type. DEFAULT: *.rb
View sha-256-hex-password
#!/bin/bash
# TODO would it be possible to write in one line?
echo "Password: "
read -s password
echo -n $password | openssl dgst -sha256 -binary | xxd -p
@fabioyamate
fabioyamate / nokogiri
Created Jun 18, 2010
nokogiri installation from libxml2 and libxslt macosx
View nokogiri
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
@fabioyamate
fabioyamate / curb_ubuntu.txt
Created Nov 11, 2010
installing curb on ubuntu 10.04
View curb_ubuntu.txt
# installing curb gem on Ubuntu require libcurl
sudo apt-get install libcurl3-dev
Or new version, but it conflicts if some libraries.
sudo apt-get install libcurl4-dev
(some other packages libcurl4-openssl-dev libcurl4-gnutls-dev)
gem install curb
@fabioyamate
fabioyamate / promise.js
Created Jun 9, 2014
Promise polyfill with jQuery Deferreds
View promise.js
function Promise(fn) {
this.promise = $.Deferred(function(dfd) {
fn(dfd.resolve, dfd.fail);
}).promise();
}
Promise.prototype.then = function(done, fail) {
this.promise.then(done, fail);
};
View xmobarrc
Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, borderColor = "black"
, border = TopB
, bgColor = "black"
, fgColor = "grey"
, position = TopW L 100
, commands = [ Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Network "eth1" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
View subdb.sh
#!/bin/bash
foo=$1
p1=
cat <(`dd bs=1024 count=64 if=$foo`) <(`tail -c 65536 $foo`) | md5
@fabioyamate
fabioyamate / keybase.md
Created Feb 21, 2016
keybase prove github
View keybase.md

Keybase proof

I hereby claim:

  • I am fabioyamate on github.
  • I am fabioyamate (https://keybase.io/fabioyamate) on keybase.
  • I have a public key ASCozQOWUcCj_hY3NCJ60wJIR0BMIfMVE5AVlC8I_PCkCgo

To claim this, I am signing this object:

@fabioyamate
fabioyamate / alias.bash
Last active Feb 20, 2016
jQuery, AngularJS snippet to start working
View alias.bash
# Add an alias to your .bash_profile
#
# alias sjquery='curl https://raw.github.com/gist/2884873/jquery.html -L -o'
# alias sangular='curl https://raw.github.com/gist/2884873/angular.html -L -o'
#
# Updates:
# * using http://rawgithub.com service to include files directly from server
#
# Usage
#