Skip to content

Instantly share code, notes, and snippets.

@perilstar
perilstar / IMDB stuff.py
Created November 3, 2016 14:40
IMDB stuff created by ekyl - https://repl.it/ENqy/0
import numpy as np
class Episode:
def __init__(self, title, rating):
self.title = title
self.rating = rating
episodes = []
episodes.append(Episode("Thing 1", 3.9))
episodes.append(Episode("Thing 2", 7.3))
@perilstar
perilstar / Main.java
Created January 24, 2017 20:46
Determine if a set of cards (represented by int values) has a full house in linear time
public static boolean hasFullHouse(int[] arrIn) {
int[] count = new int[13];
int two = 0,
threeOrGreater = 0;
for (int i = 0; i < arrIn.length; i++) {
count[arrIn[i] - 1]++;
}
for (int i = 0; i < 13; i++) {
if (count[i] == 2) {
two++;
@perilstar
perilstar / Main.java
Created January 25, 2017 17:21
In theory, find full house in a set of arbitrary ints
public class Main {
public static void main(String[] args)
{
int[] a = new int[]{1,1,2,5,2,1,4};
System.out.println(hasFullHouse(a)?"Full house!":"Better luck next time");
}
@perilstar
perilstar / Toaster.rb
Created August 29, 2017 13:36
Toaster created by ekyl - https://repl.it/DBZp/0
def toaster str
case str
when "bread"
"toast"
when "toast"
"extra crispy toast"
when "bagel"
"pizza"
when "poptart"
"cooked poptart"
@perilstar
perilstar / Point.pde
Last active September 1, 2017 18:27
art stuff
class Point {
private float x, y;
private float direction;
public float speed;
Point() {
this.x = mouseX;
this.y = mouseY;
this.direction = 0;
}
@perilstar
perilstar / Encrypty thing.cpp
Created September 1, 2017 13:02
Encrypty thing created by ekyl - https://repl.it/K9KG/3
#include<iostream>
using namespace std;
char encryptChar(char c, int key) {
key %= 52
if (c < 65 || (c > 90 && c < 97) || c > 122) { // don't encrypt non-letters
return c;
}
if (65 <= c && c <= 90 && c+key>90) { // handling the middle bit
c += 7;
@perilstar
perilstar / dark_aerogel.terminal
Created October 20, 2017 20:30
Mac terminal theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECswLjA4NTEwMDQ0
NjQzIDAuMDg1MTAwNDQ2NDMgMC4wODUxMDA0NDY0MyAxTxAqMC4wNjc3NTEzNDA1NyAw
@perilstar
perilstar / CodeMakesStatsEasier.js
Last active December 8, 2017 17:08
Analysis of procrastination data
const _ = require('underscore');
let a = `
Always
Often
Very often
Very often
Always
Rarely
Always

the written out part

use case

You're a digital artist trying to make glitch artwork with pixel sorting. You're using Processing for this, because that's how everyone does it. However, you want to streamline more edits into your process, so you use this code to modify the hue, saturation, brightness, etc. of the image as you're sorting it.

unique

I didn't see anyone else implement a gaussian blur function did you

how it uses the different things you asked for

@perilstar
perilstar / scraper.rb
Created May 6, 2018 05:12
Minecraft username scraper
module Scraper
@@lines, @@matches = [], []
def self.input(filename)
log = File.open(filename).read
@@lines.clear
log.force_encoding("ISO-8859-1")
log.each_line {|val| @@lines.push(val.encode("UTF-8"))}
end