This file contains 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
#include <ruby.h> | |
#include <ctype.h> | |
#define MAX_LENGTH 2000 | |
VALUE rb_mBigBrain = Qnil; | |
int bigbrain_find_ideal(char *str) { | |
int len = strlen(str); | |
char* loc; |
This file contains 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/python3 | |
""" | |
Usage: ./qwerty_to_dvorak.py input.txt | |
OR cat input.txt | ./qwerty_to_dvorak.py | |
NOTE: This converts to LEFT HANDED DVORAK, not standard or right handed | |
""" | |
import sys |
This file contains 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
# frozen_string_literal: true | |
# Use `bot.include! YouTubeContainer` to use this in your CommandBot | |
# This requires you to have youtube-dl installed as well as other voice prerequisites. | |
# | |
# This example is extremely slow, but could potentially be sped up if the youtube-dl | |
# `-o -` option actually worked. If you can get it to work, hit me up because other people's | |
# older examples always fail when I run them locally. | |
require 'discordrb' |
This file contains 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
if file.respond_to?(:read) | |
if spoiler | |
filename ||= File.basename(file.path) | |
filename = 'SPOILER_' + filename unless filename.start_with? 'SPOILER_' | |
end | |
# https://github.com/rest-client/rest-client/blob/v2.0.2/lib/restclient/payload.rb#L160 | |
file.define_singleton_method(:original_filename) { filename } if filename | |
end |
This file contains 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
def lex(str, tokens=[]) | |
str.is_a?(String) ? | |
lex(StringScanner.new(str)) | |
: | |
(str.scan(/\(/) ? | |
lex(str, tokens << :l_paren) | |
: | |
(str.scan(/\)/) ? | |
lex(str, tokens << :r_paren) | |
: |
This file contains 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
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5") && ENV['OS'] =~ /Windows/i | |
module RestClient | |
module Utils | |
def self.cgi_parse_header(line) | |
parts = _cgi_parseparam(';' + line).to_a | |
key = parts[0] | |
pdict = {} | |
while (p = parts.shift) | |
i = p.index('=') |
This file contains 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
module RestClient | |
module Utils | |
def self.cgi_parse_header(line) | |
parts = _cgi_parseparam(';' + line).to_a | |
key = parts[0] | |
pdict = {} | |
while (p = parts.shift) | |
i = p.index('=') | |
if i |
This file contains 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
# from int helper | |
struct Int | |
def bit_set?(num : Int) : Bool | |
return (bit num) == 1 | |
end | |
end | |
struct UInt8 | |
def bit_set?(num : Int) : Bool | |
return (bit num) == 1 |
This file contains 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
https://dl.dropboxusercontent.com/u/36785145/tilemap2.png |
This file contains 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 "trie" | |
trie = Trie.new | |
dict = {} | |
File.open("/usr/share/dict/american-english") do |f| | |
lines = f.read.split("\n") | |
lines.map(&:chomp).each {|word| (dict[word.size]||=Trie.new).add word, 1 } | |
end | |
letters = "psylyrcytyrglhltyprpsyyssysty" |
NewerOlder