Skip to content

Instantly share code, notes, and snippets.

@rvause
rvause / local.KeyRemapping.plist
Last active June 5, 2022 13:57
[Esc -> `/~] [Caps -> Esc] - For Keychron K6 or Logitech K380 (~/Library/LaunchAgents)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.KeyRemapping</string>
<key>ProgramArguments</key>
<array>
<!--
Keychron K6
@rvause
rvause / local.KeyRemapping.plist
Created October 4, 2021 07:37
Caps -> Esc and the weird K380 dual key -> ~`
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.KeyRemapping</string>
<key>ProgramArguments</key>
<array>
<!--
Item 1: 0x39 (CapsLock) -> 0x29 (Esc)
"""
Simple bot to echo events in a Twitch channel.
Need to fill out the data in the commands.Bot() call below to connect.
irc_token: You can get a token to use here by connecting your account here: https://twitchapps.com/tmi/
client_id: Register a Twitch app and copy the client_id https://dev.twitch.tv/console/apps/create
nick: Your twitch username
initial_channels: the channels you wish to watch for events on
@rvause
rvause / serverBar.js
Last active June 13, 2021 10:18
Toggle server bar in Discord client
function show() {
document.querySelector(".guilds-1SWlCJ")
.style = "display: inherit;"
window.serverBar.isVisible = true;
}
function hide() {
document.querySelector(".guilds-1SWlCJ")
.style = "display: none;"
window.serverBar.isVisible = false;
#!/usr/bin/env sh
# Simple script to switch Neocities configs for the CLI.
# Save tokens by copying "config" file to "config.<name>".
# Then use <name> to switch to that config.
# For example:
# $ mv ~/.config/neocities/config ~/.config/neocities/config.mysite
#
# With that in place you can now switch to it:
# $ neocities-switch mysite
function getBeats() {
var now = new Date();
return Math.floor((((now.getUTCHours() + 1) * 3600) + (now.getUTCMinutes() * 60) + now.getUTCSeconds()) / 86.4);
}
@rvause
rvause / config.fish
Last active October 8, 2020 16:41
Simple fish prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
set __fish_git_prompt_showuntrackedfiles 'yes'
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_branch yellow
set __fish_git_prompt_color_upstream_ahead green
set __fish_git_prompt_color_upstream_behind red
set __fish_git_prompt_color_prefix white
set __fish_git_prompt_color_suffix white
import hashlib
import io
import json
import os
from django.core.files.storage import default_storage
import googlemaps
# models.py
from .tasks import send_event
class Event(models.Model):
is_async = models.BooleanField(default=False)
# ...
def _send(self):
# do sending stuff
@rvause
rvause / migration_manifest.py
Last active June 13, 2019 18:21 — forked from alvinchow86/migration_manifest.py
django-tips-blog-migration-manifest
def handle(self, *app_labels, **options):
# Generate a migrations manifest with latest migration on each app
super(Command, self).handle(*app_labels, **options)
loader = MigrationLoader(None, ignore_no_migrations=True)
with open("latest_migrations.manifest", 'w') as f:
f.write("\n".join(sorted(f"{a}: {m}" for a, m in loader.graph.leaf_nodes())))