Skip to content

Instantly share code, notes, and snippets.

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

Tyler DataKinds

🏳️‍⚧️
owo
View GitHub Profile
@DataKinds
DataKinds / chain-mail.rb
Last active December 31, 2016 01:28
Simulate the sending of chain mail that depends on generations
#a person will have, averagely, around double the specified value
#because when it's generated, everyone has to be friends with those
#who are friends with them
AMOUNT_OF_FRIENDS = 1
FRIEND_VARIANCE = 4
POPULATION = 7400 #7.4 billion in 1000's
def a(n)
if n <= 1
1
@DataKinds
DataKinds / average.rb
Last active December 24, 2016 00:31
the ultimate font generator
#!/bin/ruby
`mkdir mean-letters`
`mkdir final-letters`
('a'..'z').each do |letter|
puts "layering #{letter}"
`convert letters/#{letter}/* -evaluate-sequence mean mean-letters/#{letter}.png`
`convert mean-letters/#{letter}.png -threshold 65% final-letters/#{letter}.png`
end
@DataKinds
DataKinds / markov.rb
Created July 7, 2016 20:38
random word generator (with multiple methods, based off of a previous markov generator)
require 'json'
TRUELOOKFORWARD = true
LOOKFORWARD = 2 #how many words forward it generates from a seed word
def prepareString(str)
#return str.downcase.split(/(\W)+/).map{|word| word.gsub(/\s+/, "")}.reject{|word| word == ""} to remind you what it was
return str.split("").push("").unshift("")
end
@DataKinds
DataKinds / Makefile
Last active June 23, 2016 04:10
math notation calculator
all:
gcc -o expression -std=c11 main.c
@DataKinds
DataKinds / Makefile
Last active June 20, 2016 05:10
controls kbd+mouse with a controller
all:
gcc -lX11 -lpthread -lXtst -std=gnu11 main.c
@DataKinds
DataKinds / coderunner.rb
Last active June 15, 2016 08:50
just my lil discord bot
module CodeRunner
def self.runCode(code, interpreter)
badKeywords = ["\`", "popen", "gets", "STDIN", "interact", "input", "system", "File", "file", "IO", "eval", "exec", "open", "write", "read", "Socket"]
malicious = false
badKeywords.each do |word|
if code.include? word then
malicious = true
end
end
@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 / cps.user.js
Last active February 14, 2016 21:22
Cookie Clicker userscript to add clicking CPS
// ==UserScript==
// @name Cookie Clicker Clicking CPS
// @namespace CookieClickerClickCPS
// @description Shows your clicking within the CPS count of Cookie Clicker
// @include http://orteil.dashnet.org/cookieclicker/
// @version 1
// @grant none
// ==/UserScript==
Game.AE_realMouseCps = 0;
Game.AE_clicksThisTimePeriod = 0;
@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 / sinarun.py
Created December 6, 2015 05:09
OSD for WASD, space, and shift for Sinarun (or similarly controlled games)
from ctypes import *
import pygame
res = (620, 400)
keySize = (100, 100)
keyMargin = 20
spaceSize = (res[0] - keyMargin * 2, 100)
backgroundColor = (0, 0, 0)
activeColor = (255, 255, 255)
deactiveColor = (128, 128, 128)