Skip to content

Instantly share code, notes, and snippets.

@avinmathew
avinmathew / find_overlaps.py
Last active May 4, 2024 20:27
Find overlapping MIDI notes
# Checks a MIDI file to see if there are any overlapping notes
# An overlapping note is defined as two MIDI on events in sequence
import math
from mido import MidiFile, tick2second
input_midi = MidiFile(r'my_midi_file.mid')
notes = {} # stores which note is being held when iterating through each event
tempo = 120 # default, tempo will be read from the file
numerator = 4 # default, will be read from the file
@tomconder
tomconder / splitmix64.c
Created May 4, 2024 20:26
SplitMix64 - very fast PRNG based on SplittableRandom
/* Written in 2015 by Sebastiano Vigna (vigna@acm.org)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
#include <stdint.h>
@XargonWan
XargonWan / japanese_locale_enabler.sh
Last active May 4, 2024 20:25
Enable Japanese locale on Steam Deck
#!/bin/bash
# This script is enabling (uncommenting) the Japanese locale and regenerates them
sudo steamos-readonly disable
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman -S glibc
sudo sed -i "s%#ja_JP.UTF-8 UTF-8%ja_JP.UTF-8 UTF-8%" /etc/locale.gen
sudo locale-gen
@adamgen
adamgen / timedatectl list-timezones
Created April 10, 2017 09:36
An online display timedatectl list-timezones list
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
@dotja
dotja / drf-api-swagger-doc.md
Last active May 4, 2024 20:22
Django REST Framework API documentation using Swagger

API Documentation with DRF and Swagger

Overview:

  • We need to create a schema. The schema outlines all the endpoints and actions of our API.

  • We need to create the documentation that is a more human-readable form of the schema.

Steps:

@ImagineGamingPlay
ImagineGamingPlay / code.bash
Created December 20, 2021 10:44
Code to put in shell
# Put this code in shell
npm init -y && npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH
@hakib
hakib / admin.py
Created December 9, 2017 08:37
Django Admin InputFilter
# common/admin.py
class InputFilter(admin.SimpleListFilter):
template = 'admin/input_filter.html'
def lookups(self, request, model_admin):
# Dummy, required to show the filter.
return ((),)
def choices(self, changelist):
@ghost1372
ghost1372 / publish.yml
Last active May 4, 2024 20:12
I use this action to publish project, compress to Zip and upload to GitHub release
name: "Publish"
on:
push:
tags:
- "v*"
env:
PROJECT_PATH: WpfApp6/WpfApp6.csproj
ZIP_PATH: WpfApp6/bin/Release/net5.0-windows/win-x86/publish/WpfApp6-Portable.zip
@ghstbny
ghstbny / media-sort.user.js
Last active May 4, 2024 20:10
Adds the ability to sort medias on bunkr and cyberdrop
// ==UserScript==
// @name media-sort
// @namespace https://github.com/ghstbny
// @match https://bunkr.*/a/*
// @match https://bunkr.ac/a/*
// @match https://bunkr.black/a/*
// @match https://bunkr.cat/a/*
// @match https://bunkr.la/a/*
// @match https://bunkr.media/a/*
// @match https://bunkr.red/a/*
@TheSherlockHomie
TheSherlockHomie / RenewExpiredGPGkey.md
Created January 3, 2021 16:36
Updating expired GPG keys and backing them up πŸ”‘πŸ”πŸ’»

Updating expired GPG keys and their backup πŸ”‘πŸ”πŸ’»

I use a GPG key to sign my git commits.

An error like this one might be a sign of an expired GPG key.

error: gpg failed to sign the data fatal: failed to write commit object