Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
#coding: binary
require 'zpng'
require 'sugar_png'
require 'pp'
# !!! convert gif file to png first
# will get 8 frames
images = Dir["task*.png"].sort.map{ |fname| ZPNG::Image.load(fname) }
@zed-0xff
zed-0xff / plte1
Last active August 29, 2015 13:57
color #0: 0b 41 77 |.Aw| used 4067089 times
color #1: ff b1 a2 |...| used 7200 times
color #2: 0b 41 77 |.Aw|
color #3: ff b1 a2 |...|
color #4: 0b 41 77 |.Aw|
color #5: ff 5b b3 |.[.| used 9000 times
color #6: 0b 41 77 |.Aw|
color #7: ff 5b b3 |.[.|
color #8: 0b 41 77 |.Aw|
color #9: ff 5b b3 |.[.|
color #0: 0b 41 77 |.Aw| used 4067089 times
color #1: ff b1 a2 |...| used 7200 times
color #2: 0b 41 77 |.Aw|
color #3: ff b1 a2 |...|
color #4: 0b 41 77 |.Aw|
color #5: ff 5b b3 |.[.| used 9000 times
color #6: 0b 41 77 |.Aw|
color #7: ff 5b b3 |.[.|
color #8: 0b 41 77 |.Aw|
color #9: ff 5b b3 |.[.|
#include <string.h>
#include <sys/fcntl.h>
#include <mdbm/mdbm.h>
#include <mdbm/mdbm_handle_pool.h>
#include <stdlib.h>
#include <pthread.h>
#include <thread>
#include <iostream>
#include <vector>
#!/usr/bin/env ruby
# this tool is similar to "git bisect" one, but for specs.
# it tries to find what spec from list of specs breaks execution of one specified spec.
#
# see more at http://zed.0xff.me/2010/01/28/rspec-bisect
#
# usage example:
# ./rspec-bisect.rb spec/**/*_spec.rb spec/controllers/spaces/tickets_controller_spec.rb
# [.] rspec runner: ./script/spec
@zed-0xff
zed-0xff / antiSiggen3.rb
Created January 17, 2012 13:09
script for decoding JPG / DOC / XLS / etc files that were encoded with Trojan.Siggen3.35000
#!/usr/bin/env ruby
#coding: binary
#
# script for decoding JPG / DOC / XLS / etc files that were encoded with
# Trojan.Siggen3.35000
# Trojan.Dropper-31300
#
#
# some useful links:
#
@zed-0xff
zed-0xff / gist:8181593
Created December 30, 2013 12:31
eventlogs compression
orig: 512M eventlogs file
gzip 51M 10s
bzip2 25M 120s
xz 15M 150s
pixz 16M 15s
pixz -7 15M 15s !!!
pixz -8 14M 22s
pixz -9 13M 40s
pxz 16M 18s
@zed-0xff
zed-0xff / rimword_mods2commits.rb
Last active April 7, 2020 17:22
RimWorld: convert each record from a mods list to a separate commit
#!/usr/bin/env ruby
# a code for an article at https://www.reddit.com/r/RimWorld/comments/fwoi36/using_bisection_power_of_git_to_identify_a_buggy/
ORIG_CONFIG_FNAME = "ModsConfig.xml.orig"
CONFIG_FNAME = "ModsConfig.xml"
ALWAYS_ADD = []
ALWAYS_ADD << 'brrainz.harmony'
ALWAYS_ADD << 'ludeon.rimworld'
#!/usr/bin/env ruby
N = 100000
s = "foobarbaz"
@results = []
SRC = File.readlines(__FILE__)
print "[.]"
def bench title = nil