Skip to content

Instantly share code, notes, and snippets.

View fabioyamate's full-sized avatar

Fabio Yamate fabioyamate

View GitHub Profile
@fabioyamate
fabioyamate / mover
Last active November 7, 2023 02:30
unRAID mover script
#!/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 April 26, 2012 21:26
Replacing string in with sed
# 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
#!/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 June 18, 2010 02:56
nokogiri installation from libxml2 and libxslt macosx
# 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 November 11, 2010 12:50
installing curb on ubuntu 10.04
# 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 June 9, 2014 20:37
Promise polyfill with jQuery Deferreds
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);
};
@fabioyamate
fabioyamate / xmobarrc
Created March 14, 2017 13:53
Xmonad config
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
#!/bin/bash
foo=$1
p1=
cat <(`dd bs=1024 count=64 if=$foo`) <(`tail -c 65536 $foo`) | md5
@fabioyamate
fabioyamate / keybase.md
Created February 21, 2016 02:13
keybase prove github

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 February 20, 2016 03:41
jQuery, AngularJS snippet to start working
# 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
#