Skip to content

Instantly share code, notes, and snippets.


Adan Alvarado aalvarado

Block or report user

Report or block aalvarado

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
aalvarado /
Created Sep 29, 2015 — forked from jirutka/
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
# The MIT License
# Copyright 2014 Jakub Jirutka <>.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View inverse_of_test.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source ''
gem 'rails', '4.2.0'
gem 'arel'
gem 'sqlite3'
system 'bundle'
View gist:46e5678f3c65492010e5
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
View 99-displaymagic.rules
# enable LVDS on HDMI disconnect
SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/"
View positions_controller.rb
before_filter :find_position, only: [:show, :destroy, :edit]
def destroy
if @position.destroy
flash[:success] = t('labels.success')
flash[:error] = t('labels.error')
redirect_to positions_path
aalvarado / gist:2304758
Created Apr 4, 2012 — forked from EnriqueVidal/gist:2304702
Extract emails from files
View gist:2304758
#!/usr/bin/env bash
function email_extract {
if [ -z "$1" -o -z "$2" ]; then
echo usage: email_extract path file
echo example: email_extract . *.php
return 1
find $1 -iname $2 -exec perl -wne'while(/[\w\.]+@[\w\.\-]+\w+/g){print "$&\n"}' {} \;
You can’t perform that action at this time.