Skip to content

Instantly share code, notes, and snippets.

View DataKinds's full-sized avatar
🏳️‍⚧️
owo

Tyler DataKinds

🏳️‍⚧️
owo
View GitHub Profile
@DataKinds
DataKinds / extract.rb
Created November 29, 2015 21:09
Extract png spritesheets from gamemaker "data.win" files
#!/usr/bin/ruby
PNGHEADER = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]
PNGENDING = [0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82]
pngHeaders = []
File.open("data.win", "rb") do |file|
puts "searching for png headers"
globalIndex = 0
headerInnerIndex = 0
@DataKinds
DataKinds / genome.py
Last active October 5, 2020 08:21
CS homework
"""
Filename: genome.py
Author: Tyler
Purpose: Construct phylogenetic trees.
"""
# ;; Consider this my final hoorah before dropping my CS major.
# ;; https://xkcd.com/224/
code="""
@DataKinds
DataKinds / chord.rb
Last active January 31, 2020 13:34
circle modular multiplication chord renderer
require "rmagick"
RESOLUTION = 800
def localToGlobalCoords(n)
#local go from -1 to 1
#global go from 0 to RESOLUTION
#x always equals y, the image is square
return ((n + 1)*(RESOLUTION/2)).floor
end
@DataKinds
DataKinds / Gemfile
Last active May 20, 2019 09:48
Directed graph of TVTropes links
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "nokogiri"
@DataKinds
DataKinds / d.hs
Last active April 27, 2019 05:52
import Numeric
import Data.Ratio
data Op =
Plus Op Op
| Mul Op Op
| Pow Op Op
| Ln Op
| E Op
| Pi Op
@DataKinds
DataKinds / fontDownload.rb
Last active April 9, 2019 03:27
download all top fonts off dafont
require "nokogiri"
require "open-uri"
`rm fontUrls`
fontUrlFile = File.open("fontUrls", "a")
(1..50).each do |pageIndex|
page = Nokogiri::HTML(open("http://www.dafont.com/top.php?page=#{pageIndex}"))
page.css(".dlbox .dl").each do |downloadButton|
fontUrlFile.puts "https:#{downloadButton['href']}"
puts downloadButton["href"]
@DataKinds
DataKinds / repl.p6
Last active April 6, 2019 07:45
perl6 better repl
#!/usr/bin/env perl6
use MONKEY;
use nqp;
module TREPL {
### STATIC DEFINITIONS ###
role Descriptive[Str $desc] {
has Str $.Desc = $desc;
}
{-# LANGUAGE ViewPatterns #-}
import Data.List
dropPieces :: [String] -> [String]
dropPieces (top:mid:rows) =
let willDrop = zipWith (\t m -> m == '-' && t /= '-') top mid
newTopRow = (\(t,m,w) -> if w then '-' else t) <$> (zip3 top mid willDrop)
newMidRow = (\(t,m,w) -> if w then t else m) <$> (zip3 top mid willDrop)
in
@DataKinds
DataKinds / Functions.hs
Last active May 6, 2018 22:40
Scheme Boi
module Functions where
import SExpr
mathF :: (Integer -> Integer -> Integer) -> String -> Literal -> Literal -> Literal
mathF op s (LNum a) (LNum b) = LNum $ a `op` b
mathF _ s _ _ = error $ "Non number passed to " ++ s
addF :: Literal -> Literal -> Literal
addF a b = mathF (+) "+" a b
template<std::vector<std::string>* arg, std::string_view* flag, std::function<void()>* f>
struct CommandLineLambda {
//returns whether or not the argument was called
static inline bool runArg() {
auto iter = std::find(arg->begin(), arg->end(), *flag);
if (iter != arg->end()) {
(*f)();
return true;
}
return false;