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
aalvarado / pg_change_db_owner.sh
Created Sep 29, 2015 — forked from jirutka/pg_change_db_owner.sh
Some convenient scripts to manage ownerships and privileges in PostgreSQL.
View pg_change_db_owner.sh
#!/bin/bash
#
# The MIT License
#
# Copyright 2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# 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 'https://rubygems.org'
gem 'rails', '4.2.0'
gem 'arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
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
#/etc/udev/rules.d/99-displaymagic.rules
# enable LVDS on HDMI disconnect
SUBSYSTEM=="drm", ACTION=="change", RUN+="/usr/local/bin/displaymagic.sh"
View positions_controller.rb
before_filter :find_position, only: [:show, :destroy, :edit]
def destroy
if @position.destroy
flash[:success] = t('labels.success')
else
flash[:error] = t('labels.error')
end
redirect_to positions_path
end
@aalvarado
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
fi
find $1 -iname $2 -exec perl -wne'while(/[\w\.]+@[\w\.\-]+\w+/g){print "$&\n"}' {} \;
You can’t perform that action at this time.