Skip to content

Instantly share code, notes, and snippets.

View tinytengu's full-sized avatar
👺
Doing tinytengu things

Daniel tinytengu

👺
Doing tinytengu things
View GitHub Profile
@tinytengu
tinytengu / python_diffs.py
Created August 30, 2023 13:11
Python 3 file & text differences detection
import difflib
from dataclasses import dataclass, field
@dataclass(frozen=True)
class LineAdded:
line: str
content: str
@tinytengu
tinytengu / fixes.ps1
Created November 26, 2022 20:00
Some WSL2 fixes
# Slow Network Fix
wsl --shutdown
Set-NetAdapterLso -Name "vEthernet (WSL)" -IncludeHidden -IPv4Enabled $False -IPv6Enabled $False
# Minimal Config (forward ports & limit ram)
[wsl2]
memory=2GB
localhostForwarding=true
@tinytengu
tinytengu / git-gpg.sh
Created November 26, 2022 16:34
Git GPG signing commands
gpg --list-secret-keys --keyid-format=long
git config --global --unset gpg.format
git config --global user.signingkey OUTPUT_GPG_KEY!
git config --global commit.gpgsign true
@tinytengu
tinytengu / minecraft.py
Created October 10, 2022 00:56
Python script to launch Minecraft on linux from terminal
import os
import json
import subprocess
DIRNAME = os.path.join(os.path.dirname(__file__), ".minecraft")
LIBRARIES = os.path.join(DIRNAME, "libraries")
VERSIONS = os.path.join(DIRNAME, "versions")
VERSION = "1.12.2"
@tinytengu
tinytengu / install.sh
Last active October 4, 2022 01:26
Ubuntu 22.04 AndroidSDK Install
# AndroidSDK
sudo snap install androidsdk
# JDK 8
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
# .bashrc / .zshrc
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
export ANDROID_HOME="$HOME/AndroidSDK"
@tinytengu
tinytengu / .gnomerc
Created October 3, 2022 20:14
Gnome 22.04 switch keyboard layout on LAlt+Shift avoiding delay and other bugs
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Shift>Alt_L']"
gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward "['<Alt>Shift_L']"
@tinytengu
tinytengu / cheatsheet.txt
Created June 18, 2022 21:43
neovim cheatsheet
[Movement]
(Lines)
<n>G or <n>gg - go to <n>th line
$ - go to end of the line
0 - go to the beginning of the line
^ - go to the first non-empty character of the line
<n>% - go to the <n>% of the file
<n>up/down - go <n> lines up/down
(Words)
@tinytengu
tinytengu / profile.ps1
Created June 8, 2022 20:07
Oh My Posh Config
$THEME_NAME = "takuya";
$THEME_CUSTOM = 0;
$THEME_URL = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/default.omp.json"; # For THEME_CUSTOM = 1
if($THEME_CUSTOM -eq 0) {
$THEME_URL = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/${THEME_NAME}.omp.json";
}
oh-my-posh init pwsh --config "${THEME_URL}" | Invoke-Expression
@tinytengu
tinytengu / mixin.py
Last active June 27, 2022 14:46
Miltiple field lookup mixin for Django Rest Framework
from django.shortcuts import get_object_or_404
class MultipleFieldLookupMixin:
lookup_ignorecase = True
def get_object(self):
queryset = self.get_queryset()
queryset = self.filter_queryset(queryset)
filter = {
"{}{}".format(
@tinytengu
tinytengu / rain.js
Last active March 7, 2022 10:42
JavaScript rain canvas animation
const MAX_PARTICLES = 500;
const PARTICLE_COLOR = "rgba(174, 194, 224, 0.5)";
const PARTICLE_SPEED = 10;
const TEXT_COLOR = "rgba(255, 255, 255, .2)";
const TEXT_FONT = "bold 36px Arial";
const body = document.body;
function randomInt(min, max) {