This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'packetfu' | |
include PacketFu | |
iface = ARGV[0] || "en1" | |
def sniff(iface) | |
cap = Capture.new(:iface => iface, :start => true) | |
cap.stream.each do |p| | |
pkt = Packet.parse p | |
if pkt.is_tcp? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'git' | |
require 'fileutils' | |
require 'yaml' | |
class Key < ActiveRecord::Base | |
def self.authorized_keys_content | |
Key.all.each.reduce('') do |ac, key| | |
ac << "#{key.public_key}\n" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Inspector | |
def inspect_objects_space | |
count = Hash.new(0) | |
ObjectSpace.each_object(Object) {|o| count[o.class] += 1 } | |
server = TCPSocket.new 'localhost', 51313 | |
max = count.reduce do |a, v| a[1] > v[1] ? a : v end | |
server.puts max.to_s | |
server.close | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) | |
Thread.start(TCPServer.new(51313)) do |server| | |
loop do | |
puts "listening" | |
client = server.accept | |
puts "new client" | |
while line = client.gets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cp = require('child_process'); | |
function *doKill(process, initial_delay) | |
{ | |
yield process.kill('SIGTERM'); | |
yield process.kill('SIGKILL'); | |
} | |
function niceKill(process, onExit, initial_delay) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fastroza (TM) | |
// Comments about https://mobile.twitter.com/lukaseder/status/867080556470730752 | |
var js_behavior = false | |
function add(_x, _y) { // (x) + (b) | |
// Normalization to Number | |
var x = +_x | |
var y = +_y | |
if(!js_behavior) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Autoclip | |
// @namespace http://nedmedia.io | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author F | |
// @update https://gist.github.com/astroza/ff89cc940b33ad9319bf3ae8ae6da641/raw/17f3e11fda0f4c7831bc232870c4971165f9bf42/autoclip-wordpress.user.js | |
// @match http://*/wp/wp-admin/post.php?post=* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* fastroza@ned.cl | |
*/ | |
const spawn = require('child_process').spawn; | |
const frame_regex = /\[FRAME\]\n([\/\w=\n\.:\d\-_\s]*)\[\/FRAME\]\n/g; | |
const value_regex = /([\w_]*)=([\/\d\.\w_:]*)/g; | |
function digest_frame(str) | |
{ | |
ret = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index_path(deep_hash, path) | |
sp = path.split("/") | |
d = 0 | |
while d < sp.length | |
hk = sp.slice(sp.length - d - 1, sp.length) | |
if deep_hash[d] == nil | |
deep_hash[d] = {} | |
end | |
l = deep_hash[d][hk] | |
if l == nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SingletonTest | |
def data | |
@data | |
end | |
def data=(n) | |
@data = n | |
end | |
@old_new_method = self.method(:new) |
OlderNewer