Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#define lazyPrint(x) std::cout << #x "=" << (x) << std::endl
@adrianmgg
adrianmgg / css.css
Created February 3, 2021 06:20
streamlabs shake animation (wip)
.widget-AlertBox {
position: relative;
}
body,
html {
height: 100%;
width: 100%;
overflow: hidden;
}
#wrap {
# "Although the ROM provides a graphic for all 256 different possible 8-bit
# codes, some APIs will not print some code points, in particular the range
# 0-31 and the code at 127.[10] Instead, they will interpret them as control
# characters." (https://en.wikipedia.org/wiki/Code_page_437)
# the table from unicode mapped to the control characters, the table from ibm
# mapped to the graphics instead but wasn't in a format fontforge can import.
#
# GCGIDs from the ibm one converted using this for reference
# https://gist.github.com/SonOfLilit/2a144d525b32978fd3ae1adddd27d621
#
(async function(){
function sleep(ms){return new Promise(function(resolve){setTimeout(resolve,ms);});}
const A = 'A'.charCodeAt(0);
const Z = 'Z'.charCodeAt(0);
let valid_suffixes = [];
for(let a = A; a <= Z; a++) {
for(let b = A; b <= Z; b++) {
let suffix = String.fromCharCode(a) + String.fromCharCode(b);
let url = `https://static-cdn.jtvnw.net/emoticons/v2/302662742_${suffix}/default/light/3.0`;
let response = await fetch(url)
# WARNING: this code is kinda janky and i wouldn't suggest using it
# this decorator lets you write stuff like this:
# @versiononly(2)
# def foo():
# print('python 2 implementation of foo')
# @versiononly(3)
# def foo():
# print('python 3 implementation of foo')
@adrianmgg
adrianmgg / new_file_without_extension.reg
Last active October 21, 2021 01:17
windows registry stuff
Windows Registry Editor Version 5.00
; add 'file without extension' to file explorer's right click > new > ... dialog
; .file_without_extension is a dummy name since afaik we need to have some extension
; associated in order to add it to the menu.
[HKEY_CLASSES_ROOT\.file_without_extension]
@="FileWithoutExtension"
[HKEY_CLASSES_ROOT\.file_without_extension\ShellNew]
; create an empty file (as opposed to from a template)
/*
user-defined string literal operator to parse windows api GUIDs from strings at compile time.
any of these will work:
- "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"_guid
- "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"_guid
- "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"_guid
*/
#pragma once
#ifndef __GUID_LITERAL_H__
function createElementHelper(tagName, {style:{vars:styleVars={}, ...style}={}, attrs={}, events={}, classList=[], children=[], parent=null, insertBefore=null, ...props}={}) {
let elem = document.createElement(tagName);
for(let k in style) elem.style[k] = style[k];
for(let k in styleVars) elem.style.setProperty(k, styleVars[k]);
for(let k in attrs) elem.setAttribute(k, attrs[k]);
for(let k in events) elem.addEventListener(k, events[k]);
if(classList.length > 0) elem.classList.add.apply(elem.classList, classList);
for(let k in props) elem[k] = props[k];
for(let c of children) elem.appendChild(c);
if(parent !== null) {
<svg viewBox="0 0 512 512" width="256" height="256" xmlns="http://www.w3.org/2000/svg" style="position:absolute;top:0px;left:0px;width:100vw;height:100vh;">
<style>
:root {
--grass-dark: #7ebe54;
--grass-light: #97c667;
--dirt-dark: #79553a;
--dirt-light: #b9855c;
<svg viewBox="0 0 512 512" width="256" height="256" xmlns="http://www.w3.org/2000/svg" style="position:absolute;top:0px;left:0px;width:100vw;height:100vh;">
<style>
:root {
--grass-dark: #7ebe54;
--grass-light: #97c667;
--dirt-dark: #79553a;
--dirt-light: #b9855c;