Skip to content

Instantly share code, notes, and snippets.

View numinit's full-sized avatar

Morgan numinit

View GitHub Profile
@numinit
numinit / valve.rb
Last active December 31, 2015 00:50
#!/usr/bin/env ruby
# usage: $0 <app ID> <passcode>
require 'uri'
require 'json'
require 'net/http'
module Valve
URI_FORMAT = 'http://store.steampowered.com/actions/clues?key=%s'.freeze
REFERER_FORMAT = 'http://store.steampowered.com/app/%d'.freeze
@numinit
numinit / levels.md
Last active December 26, 2015 06:29

Ingress: Upcoming AP changes

Ingress has 36 levels, called "client levels." Gameplay levels (1 to 8) can be given by the expression floor(clientLevel/5) + 1.

Some new changes are coming up that will probably help newer players. Here they are.

Level AP Threshold (new) AP Threshold (old) Delta
1 0 0 0
1 500 2000 -1500
#include "lc3.h"
static lc3 *global_ctx = NULL;
static struct termios oldt, newt;
void lc3_printf(const char *format, ...) {
va_list args;
const char *ptr;
FILE *stream;
@numinit
numinit / ichat.rb
Last active December 11, 2015 01:49
puts "*** Loading Objective-C dependencies, this will take a moment"
require 'rubygems'
require 'htmlentities'
require 'json'
framework 'Foundation'
framework 'AppKit'
class Person
#if defined(MACOS)
#define HAVE_STRUCT_TIMESPEC 1
#include <mach-o/dyld.h>
#include <libgen.h>
#elif defined(LINUX)
#elif defined(WINDOWS)
#endif
#include <stdio.h>
#include <locale.h>
a = ->(s, t) {s.length == t.length && (u = ->(v){v.bytes.reduce(1){|w, x| w * [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103][(x & 0x1f) - 1]}}).call(s) == u.call(t)}
@numinit
numinit / cout.rb
Created September 18, 2012 17:37
module Kernel
def std
@@std ||= Module.new do
def ios
Module.new do
def ios
@@ios ||= Class.new do
def initialize stream
@stream = stream
end
@numinit
numinit / dm.rb
Created September 10, 2012 06:22
#!/usr/bin/env ruby
# `ruby dm.rb 1d8`, `ruby dm.rb 3d8+5`, `ruby dm.rb 100d10+3`, etc...
# down to one line now ;)
['Rolling... '.tap{%w(colorize net/http).map &method(:require)}.blue, ((res=->(d, rnd){d.count > 1 ? ((quota = (get = ->(uri={}) {Net::HTTP.start((u = URI::HTTP.build(uri.merge(host: 'www.random.org'))).hostname, u.port) {|h| h.request(Net::HTTP::Get.new(u.request_uri, {'User-Agent' => '<user agent here>'}))} rescue nil}).call(path: '/quota/', query: URI.encode_www_form(format: :plain))).is_a?(Net::HTTPSuccess) && quota.body.strip.to_i > 0 ? ((result = get.call(path: '/integers/', query: URI.encode_www_form(format: :plain, rnd: :new, num: d.first, col: d.first, min: 1, max: d[1], base: 10))).is_a?(Net::HTTPSuccess) ? result.body.split.collect(&:to_i) : rnd.call(d[0], d[1])) : rnd.call(d[0], d[1])) : 'invalid or no dice provided'}.call(((a=ARGV.first.to_s.split(/[d+]/).collect(&:to_i).reject{|d| d <= 0}).length == 2 ? a.push(0) : a), ->(d, n){Array.new(d) {rand(1..n)}})).is_a?(Array) ? "#{res.col
(i = ->(a, b, f) {
(
(opposite = ->(u, v){u < 0 && v > 0 || u > 0 && v < 0}).call(
f_a = f.call(a),
f_b = f.call(b)
) ?
(
(f_mid = f.call(mid = (a + b) / 2.0)).abs < Float::EPSILON ?
mid :
i.call(
puts (Class.new(Time) {|c| c.send(:define_method, :to_s) {"#{%w(Sun Morn Tir Mid Tur Fre Lore)[wday]}das, #{mday}#{%w(st nd rd th)[(mday >= 11 && mday <= 13 || (a = (mday - (mday.to_f / 10.0).floor * 10) - 1) > 3 ? 3 : a)]} of #{['Morning Star', 'Sun\'s Dawn', 'First Seed', 'Rain\'s Hand', 'Second Seed', 'Midyear', 'Sun\'s Height', 'Last Seed', 'Hearthfire', 'Frostfall', 'Sun\'s Dusk', 'Evening Star'][month - 1]}, 4E #{year - 1810}"}}).now.to_s