Skip to content

Instantly share code, notes, and snippets.

View dustinrouillard's full-sized avatar
💻
Hot boxing the server closet

Dustin Rouillard dustinrouillard

💻
Hot boxing the server closet
View GitHub Profile
@dustinrouillard
dustinrouillard / README.md
Last active May 2, 2022 08:35
Tunnel digger for ComputerCraft - 3x3 Tunnels, Torch Placer, Auto Refueling - W.I.P

Installing

To install this on your ComputerCraft Turtle run the following command

wget run https://dstn.to/cc-bore

or if you'd rather have the direct url to the install.lua from above instead of the short url

@dustinrouillard
dustinrouillard / worker.js
Last active April 18, 2022 22:14
CloudFlare worker for loading image from remote bucket and serving the contents (to avoid a redirect)
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
const domains = {
'dustin.pics': 'https://cdn.dstn.to/i',
'files.dstn.to': 'https://cdn.dstn.to/u',
'snaps.dstn.to': 'https://cdn.dstn.to/snaps',
'mods.dstn.to': 'https://solder-cdn.dustin.sh/mods',
'mirror.dstn.to': 'https://solder-cdn.dustin.sh',
@dustinrouillard
dustinrouillard / snowflake.sql
Created January 17, 2021 02:34
PostgreSQL Snowflake ID Generator Function
CREATE SEQUENCE IF NOT EXISTS public.global_id_sequence;
CREATE OR REPLACE FUNCTION id_generator(OUT result BIGINT) AS $$
DECLARE
epoch BIGINT := 1610850820000;
seq_id BIGINT;
now_millis BIGINT;
shard_id INT := 1;
BEGIN
SELECT nextval('public.global_id_sequence') % 1024 INTO seq_id;
@dustinrouillard
dustinrouillard / ytimg.js
Created January 12, 2021 16:13
CloudFlare worker for first available YouTube thumbnail (maxresdefault or hqdefault)
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
async function fetchImage(id, type = 'maxresdefault') {
const req = await fetch(`https://i.ytimg.com/vi/${id}/${type}.jpg`);
if (req.status != 200) return await fetchImage(id, 'hqdefault');
return req;
};
{
"created_at": "Sat Dec 19 02:22:35 +0000 2020",
"id_str": "1340120314898857984",
"full_text": "carp",
"display_text_range": [
0,
4
],
"entities": {},
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",
@dustinrouillard
dustinrouillard / snapchat-memory-downloader.py
Created October 29, 2020 01:57
Download Snapchat Memories from a JSON file (Comes from the Snapchat data dump)
import json
import os
import mimetypes
import requests
import datetime as dt
from multiprocessing.pool import ThreadPool as Pool
with open('memories.json', 'r') as memories_file:
memories_data=memories_file.read()
@dustinrouillard
dustinrouillard / kush.js
Created July 26, 2020 07:19
Cloudflare worker that runs kush.pics
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
const default_image = '';
const kushes = [
'https://www.mensjournal.com/wp-content/uploads/mf/weed-marijuana.jpg',
'https://dynaimage.cdn.cnn.com/cnn/c_fill,g_auto,w_1200,h_675,ar_16:9/https%3A%2F%2Fcdn.cnn.com%2Fcnnnext%2Fdam%2Fassets%2F191031084204-marijuana-flower-stock.jpg',
'https://media.npr.org/assets/img/2019/03/19/weed-bud-bc500c4866252c287b190cd5fe679238b2a91982.jpg',
'https://d279m997dpfwgl.cloudfront.net/wp/2018/06/0605_tweed-canada06.jpg',
@dustinrouillard
dustinrouillard / flax.js
Created July 26, 2020 07:05
Cloudflare worker which runs flax.pics
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
const default_image = 'https://i0.wp.com/images-prod.healthline.com/hlcmsresource/images/AN_images/flaxseeds-1296x728-feature.jpg?w=1155&h=1528';
const flaxes = [
"https://i0.wp.com/images-prod.healthline.com/hlcmsresource/images/AN_images/flaxseeds-1296x728-feature.jpg?w=1155&h=1528",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT6rY8sUlsTvYmlY_Pb_IY8-n3VDlGUiX02Eg&usqp=CAU",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTvw3pLRTTi_7mHbUhVIAK4nrIft3TutGEw7w&usqp=CAU",
"https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcTq9yGFnyVm3Cazw6p6h287w3HcYWqNjTIfug&usqp=CAU",
@dustinrouillard
dustinrouillard / worker.js
Last active July 12, 2021 23:43
Cloudflare worker which runs fax.pics, flax.pics, burmese.pics, siamese.pics, marley.pics, and kush.pics
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
});
const start_images = 1;
const end_images = 47;
const image_folder = 'marley';
const default_image = `https://dustin.wtf/${image_folder}/1.jpg`;
@dustinrouillard
dustinrouillard / auto_theme.py
Last active July 14, 2020 04:40
This python script will make iTerm with your macOS theme. (Requires a Profile called Light and Dark)
#!/usr/bin/env python3
import asyncio
import iterm2
async def main(connection):
app = await iterm2.async_get_app(connection)
effectiveTheme = await app.async_get_variable("effectiveTheme")