Skip to content

Instantly share code, notes, and snippets.

@dolzenko
dolzenko / irssi_trigger_echo_last_messages.sh
Last active August 13, 2017 18:37
IRC logging bot using irssi
$ mkdir -p ~/.irssi/scripts/autorun/
$ cd ~/.irssi/scripts/autorun/
$ wget http://wouter.coekaerts.be/irssi/scripts/trigger.pl
$ irssi
/server add -auto -network Freenode irc.freenode.net 6667
/channel add -auto ##channel Freenode
/SET autolog ON
/trigger add -joins -command 'exec -o tail -10 ~/irclogs/Freenode/\#\#channel.log'
@dolzenko
dolzenko / hows.rb
Last active December 16, 2015 15:59
require 'stamp'
require 'text-table'
def how(ts)
hour = (ts.to_f / 3600).floor
hour % 24 + ((hour / 24 + 4).floor % 7) * 24
end
from = Time.utc(2013, 4, 7)
to = Time.utc(2013, 4, 7 + 7)
<SCRIPT
language='JavaScript1.1'
SRC="http://ad-ace.doubleclick.net/adj/N4892.273606.INFECTIOUSMEDIA1/B7321384.500;sz=300x250;ord=123123123;click=http%3A%2F%2F127.0.0.1.xip.io%2Ftracker%3Furl%3D;?"
>
</SCRIPT>
<A
HREF="${IDB:CLICK_URL}http://ad-ace.doubleclick.net/jump/N4892.273606.INFECTIOUSMEDIA1/B7321384.500;sz=300x250;ord=${IDB:CACHEBUSTER}?"
>
<html>
<body>
<script type="text/javascript" src="https://d1nzfe00velrsn.cloudfront.net/media/942Acxp9ha5yps88uWdE/fpsp.js"></script>
<script type="text/javascript">
__im_ebJnNptPjSUMVa2nHWjf.send('https://secure.adnxs.com/getuid?', {uid: '$UID', oid: 'DANROCKS'});
</script>
</body>
</html>
@dolzenko
dolzenko / gist:5143663
Last active December 14, 2015 20:28
BigDecimal simple inspect
BigDecimal.class_eval do
def inspect
to_s
end
end
extract :DWAPI do
get 'Siphon'
limit 2
resolve do |response|
rows = []
p response
response.each do |input|
p input
name = input[:name]
while :; do gulp build; inotifywait --quiet --event modify --event create --event move --event delete --exclude '#' --recursive . ; done
# Watches for all events for all files under current folder ignoring Emacs backup files
/*jslint vars: true, unparam: true, white: true */
/*global jQuery */
jQuery.fn.mintree = (function($) {
"use strict";
function MinTree(root, options) {
this.options = $.extend({}, options);
var el = $(root).addClass("mintree"),
@dolzenko
dolzenko / irb-tricks.rb
Last active October 13, 2015 03:27
IRB tricks
# Sessions
irb(main):001:0> s = "mystring"
=> "mystring"
irb(main):002:0> irb s
irb#1(mystring):001:0> size
=> 8
> IRB::ReadlineInputMethod::HISTORY.to_a # prints session history
@dolzenko
dolzenko / bid_parser.py
Last active July 21, 2017 14:51
Parse Google BidRequest/BidResponse with Python
import bidding_pb2
rq = bidding_pb2.BidResponse()
f = open('bid_response.bin', "rb")
rq.ParseFromString(f.read())
print(rq)
f.close()
rq = bidding_pb2.BidRequest()
f = open('bid_request.bin', "rb")