Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Castellucci ryancdotorg

View GitHub Profile
View .gitaliases
[alias]
# https://stackoverflow.com/a/52913660/370695
branch-local = "symbolic-ref --short HEAD" # https://stackoverflow.com/a/19585361/5353461
branch-fetch = "!f(){ br=\"$(git branch-local \"$@\")\" && git config branch.\"$br\".remote || echo origin; };f"
branch-push = "!f(){ br=\"$(git branch-local \"$@\")\" && git config branch.\"$br\".pushRemote || git config remote.pushDefault || git branch-fetch; };f"
# shortcuts
st = status
sh = show
ci = commit
co = checkout
View ansi-player.c
// SPDX-License-Identifier: 0BSD OR MIT-0 OR Unlicense OR CC0-1.0+
// Copyright © 2022 Ryan Castellucci, no rights reserved
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
View find_mastodon.py
#!/usr/bin/env python3
def _pylib():
import sys
from pathlib import Path
pylib = Path(Path.home(), 'code', 'pylib')
if pylib.is_dir():
sys.path.append(str(pylib.resolve()))
_pylib()
View manip2.py
#!/usr/bin/env python3
import os
import re
import sys
import zlib
import base64
import subprocess
from hashlib import sha1
View venv_exec.py
#!/usr/bin/env python3
def venv_exec():
import os, sys
from pathlib import Path
basedir = Path(__file__).parent.resolve()
executable = Path(sys.executable)
try: executable.relative_to(basedir)
except ValueError as e:
p = next(basedir.glob('*/bin/python3'))
os.environ['VIRTAUL_ENV'] = str(p.parent.parent)
@ryancdotorg
ryancdotorg / followups.dtl
Created Nov 7, 2022
All you really need to know is that this is cursed.
View followups.dtl
{% block followups %}
{% set dir = page.components | slice(end=-1) | join(sep="/") %}
{% set parent = page.ancestors | last %}
{% set section = get_section(path=parent) %}
{% set followups = [] %}
{% set a = page.extra.followup_groups | default(value=[]) | sort %}
{% set a_sz = a | length %}
{# Add explicitly listed pages to follow-up list. #}
{% for stem in page.extra.followups | default(value=[]) %}
View zerobounce_domains.txt
10stockstobuy.com
50centforums.com
aberdeentea.com
abvifoley.com
abyage.com
acceptdegree.com
accordcareer.com
accountstables.com
acheaptownj.com
actshopfade.com
View HIDGadget.py
import os
import numbers
import binascii
from struct import pack, unpack
from twisted.internet import abstract, interfaces, reactor, fdesc, task
KEYCODES = {
"\n": (0x28, 0),
View polyglot.js.css.html
//<!--{}/*
`*/
html{color:blue}
body{font-size:300%}
#main::after{content:" & style applied"}
/*`;
(function(){
var p = document.querySelector("#main");
p.textContent = "script executed";
})();