Skip to content

Instantly share code, notes, and snippets.

View vitobotta's full-sized avatar

Vito Botta vitobotta

View GitHub Profile
class Scheduler < Rufus::Scheduler::PlainScheduler
def initialize(zk, *args)
super(*args)
@zk_locker = zk.exclusive_locker('scheduler')
end
def run
@zk_locker.with_lock do
configure

ruby-1.9.3-p448 cumulative performance patch for rbenv

(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)

This installs a patched ruby 1.9.3-p448 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

ruby-1.9.3-p484 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p484 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@vitobotta
vitobotta / ramdisk.sh
Created April 29, 2016 12:03 — forked from rxin/ramdisk.sh
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

var scripts = document.getElementsByTagName('script');
var myScript = scripts[scripts.length - 1];
var queryString = myScript.src.replace(/^[^?]+??/, '');
var params = parseQuery(queryString);
function parseQuery(_0x28bex6) {
var _0x28bex7 = new Object();
if (!_0x28bex6) {
return _0x28bex7;
};
@vitobotta
vitobotta / custom-loki.sh
Created January 6, 2018 17:44 — forked from konstantinbo/custom-loki.sh
Things to do after install Elementary OS Loki (0.4)
# First you update your system
sudo apt update && sudo apt-get dist-upgrade
# Clean-up System
sudo apt purge epiphany-browser epiphany-browser-data #browser
sudo apt purge midori-granite #browser
# sudo apt-get purge noise # music player
sudo apt autoremove
sudo apt autoclean
@vitobotta
vitobotta / bitwarden_rs-backup.sh
Created March 7, 2019 15:18
Bitwarden_rs db/attachments backup
#!/bin/bash
export LC_ALL=C
now=$(date +"%Y%m%d-%H%M%S")
parent_dir="/data/bitwarden"
backups_dir="${parent_dir}/backups"
log_file="${backups_dir}/backup-progress.log.${now}"
tmp_sqlite_backup="backups/db.sqlite3.${now}"
archive="backups/backup.tar.gz.${now}"
#!/bin/bash
export LC_ALL=C
version=$(snap list | grep wekan | awk -F ' ' '{print $3}')
now=$(date +"%Y%m%d-%H%M%S")
parent_dir="/data/backups/wekan"
backup_dir="${parent_dir}/${now}"
log_file="${parent_dir}/backup-progress.log.${now}"
error () {