This file contains hidden or 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 ME3 Manifest Percentages | |
| // @namespace frostwyrm | |
| // @include http://social.bioware.com/n7hq/home/inventory/?name=*&platform=* | |
| // @include http://social.bioware.com/n7hq/home/characters/?name=*&platform=* | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js | |
| // ==/UserScript== | |
| var percentageize = function (type) { | |
| var denom = 0; |
This file contains hidden or 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 'net/http' | |
| require 'uri' | |
| COLOR_SOURCE_VALUES = 256 | |
| COLOR_TARGET_VALUES = 5 | |
| COLOR_DIVIDE = COLOR_SOURCE_VALUES / COLOR_TARGET_VALUES | |
| TERM_COLOR_BASE = 16 | |
| def rgb_to_xterm(r, g, b) # part of grosser.it/2011/09/16/ruby-converting-html-colors-24bit-to-xtermterminal-colors/ |
This file contains hidden or 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 | |
| class RPNError < ArgumentError | |
| def initialize sym, stack | |
| args = stack.reverse.map.with_index {|el, i| | |
| "#{el}.#{sym} (#{i} for #{el.method(sym).arity})" | |
| }.join(', ') | |
| super "wrong number of arguments: #{args}" | |
| end | |
| end |
This file contains hidden or 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 String | |
| def seq | |
| gsub(%r{ | |
| %% | | |
| % (?<bg> B )? (?<sgr> black|red|green|yellow|blue|magenta|cyan|white|[0bu!_]|clr ) | | |
| % (?<n1> \d+ )? (?<c> [\^v><\|\-!fb]<? ) (?<n2> \d+ )? | |
| }x) { | |
| match, bg, sgr, n1, c, n2 = *$~ | |
| if sgr #Select Graphic Rendition (reset, bold, underline, negative, colors) TODO: xterm colors |
This file contains hidden or 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 XTEA | |
| attr_reader :key, :key_o | |
| MASK = 0xFFFFFFFF | |
| DELTA = 0x9E3779B9 | |
| def initialize(key=rand(2**128), n=32) | |
| @key_o = key | |
| @n = n | |
This file contains hidden or 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 'net/http' | |
| $page = Regexp.new(%{<em>([0-9]+)</em></span></a></li><li><a href="[^"]+"><span><em>nast}) | |
| $dodany = %{dodany przez <a .+>%s</a>[\\s]+.*z domeny: <a href="([^"]+)"} | |
| user = ['rtoip7', 'reddigg'] | |
| def kazda_strona w, url | |
| i = s = 1 | |
| while i <= s |
This file contains hidden or 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 'net/http' | |
| require 'json' | |
| require 'date' | |
| Net::HTTP.start('www.reddit.com') do |re| | |
| 1000.times do |i| | |
| Net::HTTP.get(URI.parse 'http://www.wykop.pl/strona/'+i.to_s).scan(/span title="([^"]+)".+[\s]+z <cite><a href="([^"]+)/).each {|time, url| | |
| data = JSON.parse(re.get('/api/info.json?url='+url).body)['data']['children'].sort {|a, b| a['data']['created'] <=> b['data']['created'] }.first | |
| puts data['data']['title'], data['data']['url'], DateTime.strptime(time, '%Y-%m-%d %T').to_time - Time.at(data['data']['created']).getlocal("+02:00") - (Time.now.dst? ? 7200 : 3600) if data | |
| sleep 2 |
This file contains hidden or 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
| format ELF executable | |
| entry _start | |
| stdout = 0 | |
| stdin = 1 | |
| sys_exit = 1 | |
| sys_fork = 2 | |
| sys_read = 3 | |
| sys_write = 4 | |
| sys_waitpid = 7 |
This file contains hidden or 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 'net/http' | |
| url = URI.parse('http://www.wykop.pl') | |
| Net::HTTP.start(url.host, url.port) {|http| | |
| http.get('/ranking').body.scan(/dodane przez ([^\"]+)/).each {|nick| open(nick.first + ".jpg", 'wb') {|f| | |
| f.write Net::HTTP.get URI.parse http.get('/ludzie/' + nick.first).body[/url.+\)/][4..-2] | |
| } } | |
| } |