Skip to content

Instantly share code, notes, and snippets.

@Sorebit
Sorebit / adwaita-shell.sh
Created October 26, 2023 13:46
Extract and save default Adwaita shell theme for GNOME
#!/usr/bin/env bash
#
# adwaita-shell - extracts and saves default Adwaita shell theme for GNOME.
# Requires gnome-tweaks and User Themes extension.
# Also sudo apt install font-cantarell for default fonts.
# sorebit, https://github.com/sorebit
#
# Note: This seems to be deprecated since on new GNOME even Ubuntu allows you to pick the default accent color for Adwaita.
# Safety
@Sorebit
Sorebit / clear_logs.py
Created May 18, 2023 14:11
Clear docker log files of given container of any invalid lines
"""
Usage: python3 clear_logs.py {{ full container ID }}
Clears the log file of any lines which are not valid JSON.
No error handling whatsoever. Use at own risk.
"""
import json
import pathlib
import shutil
@Sorebit
Sorebit / pond.html
Last active November 21, 2022 15:21
💧 This is a small water pond filled with digital deterministic fish.
<!DOCTYPE html>
<meta charset="utf-8"/>
<title>💧</title>
<style type="text/css">
* {margin: 0; padding: 0;}
canvas {position: absolute; left: 0; top: 0;}
body {overflow: hidden;}
#main {background: #235d80; z-index: 1;}
</style>
<canvas id="main"></canvas>
@Sorebit
Sorebit / p2o.py
Created October 9, 2022 13:52
Pinboard -> Obsidian migration script
"""
Turns a json exported from pinboard.in into a folder of Obsidian-compliant .md notes
Usage:
python p2o.py <export.json path> <out folder>
"""
import contextlib
import dateutil
from enum import Enum
from pathlib import Path
@Sorebit
Sorebit / digger.au3
Last active June 23, 2020 20:57
AutoIt3 Club Penguin gold digger
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: https://github.com/sorebit
Script Function:
This is a Club Penguin AFK gold digger.
Usage:
1. Open cponline.pw/play in full window.
2. Scroll down.
@Sorebit
Sorebit / download.html
Last active August 10, 2018 10:28
Upload and download JSON scene config file. Will be used in Pen & Paper soon
<head>
<meta charset="utf-8">
</head>
<button id="button">Save scene</button>
<script>
// Original source: http://jsfiddle.net/4ooupev9/126/
function handleDownload() {
@Sorebit
Sorebit / pong.asm
Last active February 22, 2018 22:53
NES implementation of pong
.inesprg 1 ; 1x 16KB PRG code
.ineschr 1 ; 1x 8KB CHR data
.inesmap 0 ; mapper 0 = NROM, no bank swapping
.inesmir 1 ; background mirroring
;;;;;;;;;;;;;;;
;; DECLARE SOME VARIABLES HERE
.rsset $0000 ;;start variables at ram location 0
gamestate .rs 1 ; .rs 1 means reserve one byte of space
@Sorebit
Sorebit / openPopup.js
Last active February 13, 2018 16:02
Simple popup opener for dumps and alike
// Stolen from https://github.com/skilldrick/easy6502/blob/gh-pages/simulator/assembler.js
function openPopup(content, title) {
let w = window.open('', title, 'width=500,height=300,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,status=no');
let html = "<html><head>";
html += "<link href='style.css' rel='stylesheet' type='text/css' />";
html += "<title>" + title + "</title></head><body>";
html += "<pre><code>";
html += content;
@Sorebit
Sorebit / index.html
Created July 2, 2017 13:05
Node.js file uploader
<!DOCTYPE html>
<html>
<head>
<title>File uploader</title>
</head>
<body>
<form id="uploadForm" enctype="multipart/form-data" action="/api/status" method="post">
<input type="file" name="user-upload" />
<input type="submit" value="Upload File" name="submit">
</form>
@Sorebit
Sorebit / fastio.cpp
Last active December 4, 2016 21:48
Fast I/O for C++
#include <cstdio>
#define abs(a) ((a < 0) ? -(a) : (a))
template <class T>
void print(T a)
{
if(a == 0)
putchar_unlocked('0');
if(a < 0)