Skip to content

Instantly share code, notes, and snippets.

@drags
drags / Makefile.deps
Created June 23, 2014 02:58
Ino Makefile.deps from "Argument list too long" bug
# output of: cat Makefile.deps | perl -lape 's/ /\n/g' | sort | uniq -c > makefile_deps_uniq
19
5 >
2 |
2 -
4 :
3 $^
6 $@
4 $@~
na_dm-service:
docker.running:
- container: na_dm
- port_bindings:
"27910/udp":
HostIp: "0.0.0.0"
HostPort: "27910"
@drags
drags / cables.txt
Last active January 3, 2016 13:19
Cables for sale. $FREE.99!
~200 ft cat5, longest segment ~60ft
1x Playstation (PS1/PS2) wired controller -> USB converter
1x Xbox (original) wired controller -> USB converter
1x SATA data
1x Mini-display port -> Display port (2ft)
1x ~4ft USB extender (sparkle glitter cable!)
1x Blackberry AC -> Mini USB, (.75A)
2x Mini USB (~3ft)
2x USB A -> B (~6ft)
1x USB -> Unidentifable power connector.. 4pin, looks like an upscaled version of micro-RC helicoptor charging connector
@drags
drags / example.pp
Created November 21, 2013 23:58
Class based conditional
class rabbitmq {
# 3rd party Module
}
class node_base {
if defined(Class['::rabbitmq']) {
include nagios::applications::rabbitmq
}
}
@drags
drags / _modules haproxy.py
Last active December 22, 2015 14:58
Salt Mining and exporting
## This example module allows for generating and collecting haproxy node lines
## (Be sure to sync_modules when installing or changing modules)
##
## To add a server to a pool use haproxy.setup_node:
#$ salt '<minion target>' haproxy.setup_node <pool_name> [port]
## This sets a targeting grain and exports the haproxy line
##
## To collect the host lines on the loadbalancer use haproxy.get_servers
#$ salt '<haproxy host>' haproxy.get_output <pool_name>
## This module is best used when called by a file.managed resource
@drags
drags / gist:6471522
Last active December 22, 2015 12:19
# Steps to reproduce:
#
# GH_USER='my_github_username'
# GH_PASS='my_github_password'
#
# Create oauth token with repo:status scope:
# curl -i -d '{"scopes": ["repo:status"], "note":"Testing repo:status scope"}' "https://${GH_USER}:${GH_PASS}@api.github.com/authorizations"
# TOKEN_REPO=<insert token from output>
#
# Create oauth token with repo scope:
@drags
drags / gist:5718270
Created June 5, 2013 23:51
Fabric-1.6.1 with_jinja templating stacktrace
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/main.py", line 739, in main
*args, **kwargs
File "/Library/Python/2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/tasks.py", line 317, in execute
multiprocessing
File "/Library/Python/2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/tasks.py", line 213, in _execute
return task.run(*args, **kwargs)
File "/Library/Python/2.7/site-packages/Fabric-1.6.1-py2.7.egg/fabric/tasks.py", line 123, in run
return self.wrapped(*args, **kwargs)
File "/Users/tim/src/awesm/shares-api/fabfile.py", line 31, in deploy
@drags
drags / test_awesm_destinations.pl
Created May 9, 2012 22:56
Test load times of awesm redirect vs destination URL
#!/usr/bin/perl -w
use strict;
use Time::HiRes qw/time/;
use LWP::UserAgent;
###############################################################################
#
# compare lookup times of awe.sm versus the source urls themselves
#
# shares.csv is the input file, the first column should contain the awesm url
my ($kernel, $heap, $command, $target) = @_[KERNEL, HEAP, ARG0, ARG1];
$kernel->post('logger','log',"Got to offerbot area",$heap->{'username'}) if $config{'debug'} >=2;
my (@arg) = split / /, $command;
# setup prox table now, so table can access unmolested @arg
my @proc;
@proc = (
{ 'cmdmatch' => 'refresh|up|update',
'exec' => sub { $kernel->yield('twitter_timeline'); $kernel->yield('twitter_direct_messages') },
if (lc($item->{'user'}->{'screen_name'}) ne lc($heap->{'username'})) {
if ($heap->{'config'}->{'expand_urls'}==1 && defined($item->{'entities'}->{'urls'})) {
foreach my $url (@{$item->{'entities'}->{'urls'}}) {
$kernel->post('logger','log','Replacing URL ' . $url->{'url'} . ' with ' . $url->{'expanded_url'},$heap->{'username'}) if ($config{'debug'} >= 2);
my $search = $url->{'url'};
my $replace = $url->{'expanded_url'};
$item->{'text'} =~ s/$search/$replace/g;
# Also replace text in retweets
if(defined($item->{'retweeted_status'})) {
$item->{'retweeted_status'}->{'text'} =~ s/$search/$replace/g;