Skip to content

Instantly share code, notes, and snippets.

View scalp42's full-sized avatar
πŸ‘¨β€πŸŽ¨

Anthony Scalisi scalp42

πŸ‘¨β€πŸŽ¨
View GitHub Profile
@scalp42
scalp42 / logstash-1-collectd.conf
Last active August 29, 2015 14:26 — forked from untergeek/logstash-1-collectd.conf
Logstash 1.4.1+ Collectd configuration
# This is the simplest definition, with the addition of a type
input {
udp {
port => 25826 # Must be specified. 25826 is the default for collectd
buffer_size => 1452 # Should be specified. 1452 is the default for recent versions of collectd
codec => collectd { } # This will invoke the default options for the codec
type => "collectd"
}
}
@scalp42
scalp42 / parse-tcpdump-udp-port-53.php
Last active August 29, 2015 14:26 — forked from jtai/parse-tcpdump-udp-port-53.php
Quick and dirty script to parse output of /usr/sbin/tcpdump -vvv -s 0 -l port 53
<?php
// quick and dirty argument parsing
foreach ($argv as $arg) {
if ($arg == '-f') {
define('FOLLOW', true);
}
if ($arg == '-h') {
define('HISTOGRAM', true);
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

require 'net/http'
require 'json'
def rubygems_get(gem_name: "", endpoint: "")
path = File.join("/api/v1/gems/", gem_name, endpoint).chomp("/") + ".json"
JSON.parse(Net::HTTP.get("rubygems.org", path))
end
results = rubygems_get(gem_name: "mime-types", endpoint: "reverse_dependencies")
@scalp42
scalp42 / group.rb
Last active August 29, 2015 14:20 — forked from panthomakos/group.rb
class Group
module Error
class Standard < StandardError; end
class AlreadyAMember < Standard; end
class NotPermittedToJoin < Standard; end
end
def join user
raise Error::NotPermittedToJoin unless self.permitted?(user)
raise Error::AlreadyAMember if self.member?(user)
# In Chef, when a resource is defined all its variables are evaluated during
# compile time and the execution of the resource takes place in converge phase.
# So if the value of a particular attribute is changed in converge
# (and not in compile) the resource will be executed with the old value.
# Example problem:
# Let's consider this situation where there are two steps involved in a recipe
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed
# in converge phase
# Step 2 is a Chef resource that makes use of the node attribute that was
server {
listen 80 default_server;
listen [::]:80 ipv6only=on default_server;
server_name splunk.net blog.splunk.net www.splunk.net .taddevries.com;
access_log /var/log/nginx/blog.access_log main;
error_log /var/log/nginx/blog.error_log info;
return 301 https://blog.splunk.net;
}
server {
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
require 'json'
def pretty_json(vv, prefix='$')
if vv.is_a?(Array)
vv.each_with_index do |i, v|
pretty_json(v, "#{prefix}[#{i}]")
end
elsif vv.is_a?(Hash)
vv.each do |k, v|
pretty_json(v, "#{prefix}.#{k}")
<?php
// Licence: Do Whatever The Fuck You Want! http://www.wtfpl.net/about/
// Author: Your bro!
$fbAuth = array("facebook_id" => "123456789", "facebook_token" => "<Use charles proxy to do man-in-middle SSL sniffing and extract fb token>");
$counter = 0;
// Do the magic.
$tinderToken = tinderCall("auth", "token", $fbAuth); // Authenticate