Skip to content

Instantly share code, notes, and snippets.

@iam4722202468
iam4722202468 / youtube-downloader.py
Created July 31, 2015 04:01
Python youtube downloader by artist
#!/usr/bin/python
import sys
import wikipedia
import urllib2
from BeautifulSoup import BeautifulSoup
import os
from threading import Thread
import unicodedata
import commands
import json
@iam4722202468
iam4722202468 / ledcube.cpp
Created January 6, 2018 20:00
LED Cube Code
int latchPin = 1;
int clockPin = 0;
int dataPin = 2;
//kek, last column is on pin 3
int powers[] = {0,1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072};
char a[][5][5] = {{{B00000, B00000, B00000, B00000, B00000},{B00010, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000}},{{B00110, B00000, B00000, B00000, B00000},{B00110, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000}},{{B00110, B00100, B00000, B00000, B00000},{B00110, B00100, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000}},{{B00110, B00110, B00000, B00000, B00000},{B00110, B00110, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000},{B00000, B00000, B00000, B00000, B00000}
@iam4722202468
iam4722202468 / bbenchreader.js
Created August 29, 2021 19:56
BlockBench File Reader
const fs = require('fs');
function makeId (length) {
var result = '';
var characters = 'abcdefghijklmnopqrstuvwxyz';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
import random
size = 7
map = []
for x in range(size):
tmp = []
for y in range(size):
tmp.append('')
public void updateLighting(Pos pos, Short level) {
if (pos.blockY() < 0)
return;
int section = pos.blockY() / 16;
int sectionY = pos.blockY() % 16;
int chunkX = pos.blockX() / 16;
int sectionX = pos.blockX() % 16;
@iam4722202468
iam4722202468 / rayboundingbox.py
Created November 14, 2021 20:28
Check for intersection with bounding boxes and ray
import numpy as np
import math
vec = (1.3*4, -2.7*4, 0)
start = (1,1,0)
bb = (2,-3, -1)
bbSize = (1,1,2)
xStep = 1
@iam4722202468
iam4722202468 / sweep.cpp
Last active November 16, 2021 22:12
Sweep AABB 3d
// Extended from 2d implementation found here https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/swept-aabb-collision-detection-and-response-r3084/
// Broad-Phasing not implemented but needed to work accurately
#include <iostream>
#include <limits>
#include <algorithm>
#include <initializer_list>
struct Box
{
@iam4722202468
iam4722202468 / python
Created August 28, 2021 04:22
Free Flow Puzzle Generator
import random
paths = {}
SIZE = 7
def printPuzzle():
puzzle = []
for x in range(0, SIZE):
@iam4722202468
iam4722202468 / finder.py
Created August 26, 2022 06:27
Given a list of numbers, check if they can be added or subtracted in a way to get a specific number
import itertools
values = [-2.24, 0.46, 2.69]
toFind = 0.91
def solve(vals, target):
counter = 0
while (counter < 2 ** (len(vals))):
sum = 0
@iam4722202468
iam4722202468 / EntityCollisionUtils.java
Last active November 22, 2022 21:35
improved entity -> entity collisions
package net.minestom.server.collision;
import net.minestom.server.MinecraftServer;
import net.minestom.server.coordinate.Vec;
import net.minestom.server.entity.Entity;
import net.minestom.server.entity.EntityType;
import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.PlayerExtended;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;