Skip to content

Instantly share code, notes, and snippets.

@d6e
d6e / godot_ci_cache.py
Last active February 14, 2024 10:20
Builds the godot cache by collecting all the expected godot import paths in the *.import files, then launching godot, then waiting until it populates all the expected import paths, then stopping the godot process.
import os
import subprocess
import time
import re
from pathlib import Path
# Set the path to your Godot project and Godot executable
GODOT_PROJECT_PATH = Path("myproject")
GODOT_EXECUTABLE = "godot" # or the path to your Godot executable
GODOT_LOG_FILE = Path("artifacts") / "godot_output.log" # Log file to store Godot output
@d6e
d6e / .gitattributes
Last active May 13, 2022 04:13
Master unity gitattributes file for git LFS
# To migrate you can use the command:
# git lfs migrate import --everything --include="*.psd,*.ico,*.webp,*.png,*.jpg,*.jpeg,*.gif,*.ai,*.tif,*.tga,*.exr,*.hdr,*.otf,*.ttf,*.woff2,*.aif,*.mp3,*.wav,*.ogg,*.mp4,*.mov,*.mkv,*.avi,*.mpeg,*.mpg,*.flv,*.3dm,*.3ds,*.blend,*.c4d,*.collada,*.dae,*.dxf,*.fbx,*.jas,*.lws,*.lxo,*.ma,*.max,*.mb,*.obj,*.dll,*.dylib,*.so,*.7z,*.br,*.gz,*.tar,*.zip,*.rar,*.pdf,*.a,*.rns,*.exe,*.pdb,*.mdb,*.skel.bytes"
# git push --force --all
# git reflog expire --expire-unreachable=now --all
# git gc --prune=now
# For more information:
# https://github.com/git-lfs/git-lfs/wiki/Tutorial
# https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-migrate.1.ronn
###############################
@d6e
d6e / addswap.sh
Created August 4, 2019 22:14
Creates a temporary swap file
#!/bin/bash
SWAPFILENAME=swapfile1
SWAPPATH="/$SWAPFILENAME"
if [ ! -f "$SWAPPATH" ]; then
dd if=/dev/zero of="$SWAPPATH" bs=1024 count=1048576
chown root:root "$SWAPPATH"
chmod 0600 "$SWAPPATH"
mkswap "$SWAPPATH"
@d6e
d6e / port-forward.json
Last active September 16, 2021 23:38 — forked from thefinn93/iptables.rule
Finn's Amazing iptables Thing
// /etc/port-forward.json dont forget to delete this line since comments are not valid JSON
// These are just sample values, obviously you'll want to change most of it
{
"public-if": "enp5s0",
"port-forwards": {
"80": "10.5.0.80:80",
"443": "10.5.0.80:443",
"8443": "10.5.0.60:8443",
"5222": "10.5.0.198:5222",
"5269": "10.5.0.198:5269",
@d6e
d6e / listen.sh
Last active September 16, 2021 23:38
Some simple shell function for playing music from my terminal. This actually lives in my .zshrc
function listen() {
case "$1" in
"soma")
mplayer -playlist <(curl -s https://somafm.com/$2.pls)
;;
"bassdrive")
mplayer -playlist <(curl -s https://bassdrive.com/bassdrive.m3u)
;;
"ocean")
play -n synth brownnoise synth pinknoise mix synth sine amod 0.1 10

Keybase proof

I hereby claim:

  • I am d6e on github.
  • I am danielle (https://keybase.io/danielle) on keybase.
  • I have a public key ASC0XGm1F26TUnvYYokZYEJsS7LJ2BKBg6OuBUJYXJVknwo

To claim this, I am signing this object:

import markovify
import os
import json
import re
directory = os.path.join(os.getcwd(), "general")
filenames = os.listdir(directory)
data = []
@d6e
d6e / json_collector.py
Last active September 16, 2021 23:38
A simple python tcp server which writes json data to file
import socket
import json
HOST = ""
PORT = 8888
def send_response(msg, code, code_msg, conn):
http_response = ("HTTP/1.1 {code} {code_msg}\n\n{msg}"
"".format(code=code, code_msg=code_msg, msg=msg))
client_connection.sendall(http_response)
@d6e
d6e / check_tcp_port.py
Created September 8, 2016 20:37
Checks that a given tcp port is open.
import socket
import sys
def tcp_check(host, port=22):
ClientSocket = socket.socket()
try:
ClientSocket.connect((host, int(port)))
return_flag = True
except socket.error:
return_flag = False
@d6e
d6e / token_bucket.py
Created July 22, 2014 23:10
A demonstration of the token bucket algorithm. Useful for rate limiting networking. https://en.wikipedia.org/wiki/Token_bucket (source: http://code.activestate.com/recipes/511490-implementation-of-the-token-bucket-algorithm/)
from time import time
class TokenBucket(object):
"""An implementation of the token bucket algorithm.
>>> bucket = TokenBucket(80, 0.5)
>>> print bucket.consume(10)
True
>>> print bucket.consume(90)
False