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 / 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 / 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) {
@tinytengu
tinytengu / selenium_wait.py
Created September 18, 2021 15:19
Selenium wait for element
# Source: https://stackoverflow.com/a/26567563
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
browser = webdriver.Firefox()
browser.get("url")
@tinytengu
tinytengu / build.gradle
Created August 11, 2021 14:55
Gradle build full .jar file task
baseName = 'test'
mainClass = 'org.tinytengu.main.Main'
jar {
manifest {
attributes "Main-Class": "${mainClass}"
}
}
@tinytengu
tinytengu / build.gradle
Created August 11, 2021 14:53
Gradle import .jar files from libs/ folder
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
@tinytengu
tinytengu / cpp.json
Created July 13, 2021 17:46
[VSCode Snippet] C++ header file #ifndef pattern
{
"Header #ifndef pattern": {
"prefix": "hdef",
"body": [
"#ifndef _H_${TM_FILENAME/(.*)[.][h]$/${1:/upcase}/}",
"#define _H_${TM_FILENAME/(.*)[.][h]$/${1:/upcase}/}",
"\n${1:/* content */}\n",
"#endif"
],
"description": "Header file pattern to preserve reinclude"
@tinytengu
tinytengu / halt.bat
Created July 11, 2021 23:44
Batch force script halt for setlocal, etc.
:halt
call :__SetErrorLevel %1
call :__ErrorExit 2> nul
goto :eof
:__ErrorExit
()
goto :eof
@tinytengu
tinytengu / args_parse.bat
Created July 11, 2021 23:33
Args parse with flags Batch example
:args_loop
if "%1"=="-lt" set light_time=%2
if "%1"=="-dt" set dark_time=%2
if "%1"=="-lp" set light_theme=%2
if "%1"=="-dp" set dark_theme=%2
if "%1"=="-path" set path_type=%2
shift /1
shift /1
if not "%1"=="" goto args_loop
@tinytengu
tinytengu / apply_theme.bat
Created July 11, 2021 22:38
Apply Windows 10 & 11 theme Batch script (with settings window suppression)
:killproc
set _kpwait=%~2
if "%_kpwait%"=="" set _kpwait=0
:killproc_loop
tasklist /fi "imagename eq %~1" |find ":" > nul
if %errorlevel% neq 1 (
if %_kpwait% equ 1 goto killproc_loop
exit /B 0
)
taskkill /f /im %~1 > nul
@tinytengu
tinytengu / time_fix.bat
Last active September 23, 2021 17:05
Fix %time% output (add leading 0, trim ms)
:time_fix
set _time=%~1
if "%_time:~0,1%"==" " set %~2=0%_time:~1%
if "%_time:~1,1%"==":" set %~2=0%_time%
if "%~3"=="1" set %~2=0%_time:~0,7%
exit /B 0
rem Usage: CALL :time_fix %time% time_fixed
rem echo %time_fixed%