Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View barce's full-sized avatar

Barce barce

View GitHub Profile
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@barce
barce / gist:4f31142aaff493cb433e
Created May 30, 2014 18:04
load jquery in console and get average age from a table
var jq = document.createElement('script');
jq.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// get average age from this table: http://www.tdcj.state.tx.us/death_row/dr_executed_offenders.html
var ages = [],
sum = 0;
jQuery('tr').each(function(a,b) {
@barce
barce / gist:9da632eb65499877faf5
Created June 24, 2014 19:21
first 24 hours of #community first likes:followers
70:29909
164:25977
89:3707
305:30594
470:33812
203:5441
189:26191
190:9729
191:1808
61:23969
# Role to delete: viewer
# get role
role = Role.find_by_name('viewer')
# get user
user = User.find_by_email('foo@example.com')
# delete role by looping through role assignments
user.role_assignments.each do |ra|
Verifying that +barce is my Bitcoin username. You can send me #bitcoin here: https://onename.io/barce
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@barce
barce / Locales.yaml
Last active August 29, 2015 14:16 — forked from wojtha/Locales.yaml
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"
function fibonacci(n) {
return n<2?n:fibonacci(n-1)+fibonacci(n-2);
}
var fibonacciSeries = function(fibonacciLimit) {
var result = Array();
var currentFibonacciValue = fibonacci(0);
var i = 1;
while (currentFibonacciValue < fibonacciLimit) {
result.push(currentFibonacciValue);
@barce
barce / faraday_test.rb
Created June 8, 2015 23:00
test if faraday is working
require 'faraday'
conn = Faraday.new(:url => 'https://www.google.com') do |faraday|
faraday.request :url_encoded # form-encode POST params
faraday.response :logger # log requests to STDOUT
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
response = conn.get '/'
require 'rest_client'
require 'json'
# RestClient.log=STDOUT # Optionally turn on logging
q = '{
"query" : { "term" : { "user" : "kimchy" } }
}
'
r = JSON.parse \