Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Ellpeck's full-sized avatar
🏳️‍🌈

Ell Ellpeck

🏳️‍🌈
View GitHub Profile
@Ellpeck
Ellpeck / discordattachments.py
Created August 11, 2023 12:16
Quick and dirty python script to download all attachments from a Discord data package download
import glob
import re
import requests
regex = r"https://cdn\.[^\s]*/attachments/[^\s]*"
source = "."
destination = "./media"
for file in glob.iglob(f"{source}/**/*.csv", recursive=True):
print(file)
from names_dataset import NameDataset
import json
nd = NameDataset()
firsts = []
lasts = []
countries = ["GB", "US", "FR", "DE", "PT", "ES", "NL", "IT", "MX", "CO", "ZA", "US"]
for country in countries:
print(country)
@Ellpeck
Ellpeck / Obsidian Daily Streaks.js
Last active March 16, 2022 15:39
A simple script that can be used with Obsidian's Dataview plugin to display daily streaks of habits from your daily notes.
// For this script to work properly, each daily habit has to start with a unique emoji,
// which will also be displayed next to the daily streak for each habit.
// Daily streaks are calculated for the currently opened daily note, and end on the first day
// that the habit was not ticked off. They are displayed in order of highest to lowest length.
// To display the result of this script in your daily notes, you can use this snippet:
// ```dataviewjs
// dv.view("path/to/Obsidian Daily Streaks.js");
// ```
// This is the directory that your daily notes are in
@Ellpeck
Ellpeck / GoogleFormsToNextcloudFiles.gs
Created February 19, 2022 12:49
A simple script for Google Apps Script that automatically creates a new markdown file in a Nextcloud directory for each new Google Forms response
// How to use:
// 1. Open the script editor for the form ("Script Editor" in top right menu)
// 2. Create a new file, paste this code and edit the settings below
// 3. Go to Triggers and add a new trigger with the following settings:
// - Function: onFormSubmit
// - Event source: From form
// - Event type: On form submit
// 4. Allow permissions, and you're done!
// link to root of cloud installation
@Ellpeck
Ellpeck / Populate Data Texture Atlas.lua
Created November 11, 2021 01:16
This is a lua script for Aseprite that allows automatically populating a MLEM.Data Data Texture Atlas.
-- This is a lua script for Aseprite that allows automatically populating a MLEM.Data Data Texture Atlas.
-- To use this script, you need to select a rectangular area that should be your texture region.
-- If you want a custom pivot point, you also need to un-select exactly one pixel, the pivot point.
-- When you then execute the script and input the name of the texture region, it gets appended to the "SpriteName.atlas" file.
-- get the currently selected sprite
local selection = app.activeSprite.selection
if selection == nil then return end
local bounds = selection.bounds
@Ellpeck
Ellpeck / GoogleFormsToNextcloudDeck.gs
Last active November 9, 2021 21:37
A simple script for Google Apps Script that automatically creates a new card in Nextcloud Deck for each new Google Forms response
// How to use:
// 1. Open the script editor for the form ("Script Editor" in top right menu)
// 2. Create a new file, paste this code and edit the settings below
// 3. Go to Triggers and add a new trigger with the following settings:
// - Function: onFormSubmit
// - Event source: From form
// - Event type: On form submit
// 4. Allow permissions, and you're done!
// link to root of cloud installation
@Ellpeck
Ellpeck / pk3ds_length_shuffle.py
Created January 4, 2021 23:59
A simple script to shuffle pk3DS text dumps with a lower chance of the game crashing (by only shuffling strings with similar lengths)
# shuffles a pokemon 3ds language document based on string length with a given leeway
# needs storytext.txt and gametext.txt in the same directory
from random import randrange
# amount of characters that two string lengths can be different by to allow shuffling
leeway = 3
def is_allowed_line(line):
@Ellpeck
Ellpeck / c.c
Last active December 1, 2023 14:44
A cheat sheet that I use for C programming
// Basically imports
// <> import something from a standard library location
// "" import something from an actual path
#include <stdio.h>
#include <stdlib.h>
// Preprocessor instructions with ifdef and ifndef, needs endif at the end
// ifndef = if not defined
#ifndef OOF
// Define a variable just to do the if check