Skip to content

Instantly share code, notes, and snippets.

View thing.js
const MongoClient = require('mongodb').MongoClient;
const url = "mongodb+srv:";
const prompt = require('prompt-sync')();
let db, dbo;
run();
async function run() {
try {
@perilstar
perilstar / scraper.rb
Created May 6, 2018
Minecraft username scraper
View scraper.rb
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
View README.md

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 / CodeMakesStatsEasier.js
Last active Dec 8, 2017
Analysis of procrastination data
View CodeMakesStatsEasier.js
const _ = require('underscore');
let a = `
Always
Often
Very often
Very often
Always
Rarely
Always
View dark_aerogel.terminal
<?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
View Encrypty thing.cpp
#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;
View Point.pde
class Point {
private float x, y;
private float direction;
public float speed;
Point() {
this.x = mouseX;
this.y = mouseY;
this.direction = 0;
}
View Toaster.rb
def toaster str
case str
when "bread"
"toast"
when "toast"
"extra crispy toast"
when "bagel"
"pizza"
when "poptart"
"cooked poptart"
@perilstar
perilstar / Ruby: PBR vs PBV and data mutability.rb
Created Aug 15, 2017
Ruby: PBR vs PBV and data mutability created by ekyl - https://repl.it/KJxF/1
View Ruby: PBR vs PBV and data mutability.rb
# In this document, I'll be going over a few important concepts
# that you need to be able to understand in Ruby. The first is that of
# Pass-By-Value vs Pass-By-Reference. This is closely tied to another
# concept: mutability. First, I'll show a brief demonstration of what
# I mean.
number = 1
array = [1,2,3]
@perilstar
perilstar / Main.java
Created Jan 25, 2017
In theory, find full house in a set of arbitrary ints
View Main.java
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");
}