Skip to content

Instantly share code, notes, and snippets.

View takase1121's full-sized avatar

Takase takase1121

View GitHub Profile
@takase1121
takase1121 / changeTZ.rs
Created October 7, 2018 07:46
A small Rust program to change timezone to JST. Uses tzutil.
//A small program to change/revert timezone so I can play kancolle.
use std::fs;
use std::ffi::OsStr;
use std::process::Command;
fn main() {
//if .tzdata exists
if fs::read_dir(".").unwrap().any(|x|x.unwrap().file_name() == OsStr::new(".tzdata")) {
let last_tz = fs::read_to_string(".tzdata").unwrap();
let current_tz = Command::new("tzutil")
@takase1121
takase1121 / readme.md
Last active December 24, 2018 13:33
Use adb functions with Nox Player

If you ever need to use adb with Nox Player, you would probably just do adb devices and realize Nox Player's VM is not there. Here is a really simple command you need to do to use ADB on a Nox Player's VM.

adb connect 127.0.0.1:62001

Thats it. Do that and you'll find the VM when doing adb devices.

I don't have adb yet! Should I download it now?

@takase1121
takase1121 / sethost.ps1
Created October 6, 2019 16:30
PowerShell Script to change host file for WSL2
$global:currentIP = ""
function checkAndEdit() {
$wslOutput = & "C:\Windows\System32\wsl.exe" -l -q --running
if ($LASTEXITCODE -ne 0) {
Write-Output "Failed to get WSL status"
} else {
if ([string]::IsNullOrEmpty($wslOutput)) {
# no output, not running
Write-Output "WSL is not running, no changes needed"
@takase1121
takase1121 / README.md
Created May 31, 2020 13:47
Universal* service script for open-vm-tools (based on corresponding systemd service file)

This is my attempt of making open-vm-tools work on Artix (based on runit). After a lot of failures I came out with these.

Dependencies

  • dmidecode to read the machine info (so that script don't run when not running with VMware)

You can adapt this to whatever init system (or script) you want.

@takase1121
takase1121 / README.md
Created May 31, 2020 15:42
Mount your shared folders easily with no effort at all (VMware)

mount-vmhgfs-fuse

This script can be used to mount your shared folders easily on linux with vmhgfs-fuse

Dependencies

  • open-vm-tools
  • awk
  • getopts

TL;DR (you're just lazy) common linux things to have and open-vm-tools.

@takase1121
takase1121 / README.md
Last active November 7, 2020 01:44
Extract Wallpaper Engine PKG file (PKGV0009 only)

Extract Wallpaper Engine PKG file (PKGV0009 only)

This is a plaintext description of the format:

// file is the "entry" point
[file]
0: u32 - header length
1: bytearray($0) - header
2: u32 - number of files in archive
n: dir - directory listing
@takase1121
takase1121 / README.md
Last active November 11, 2020 01:59
Little Python tools I used

My python scripts for doing stuffs

commons.py contains a prompt function that I used.

rename.py is a tool that renames files based on their MD5 hash.

@takase1121
takase1121 / README.md
Last active June 27, 2021 08:48
Add exe files to user PATH

This Python script is used to add new executables to PATH.

  1. It recursively searches for .exe in the specified path.
  2. After that, it will compare what it finds in the path to PATH variable in the registry.
  3. It will remove invalid paths and add new ones to it.
  4. It saves the new PATH back to registry and sends a WM_SETTINGSCHANGE message so that apps update their environment variables.
@takase1121
takase1121 / README.md
Created November 16, 2020 14:39
Generate multipart data in Python3

Wrote this. Turns out I don't need it at all since urllib3 has the exact same function. welp.

@takase1121
takase1121 / PUT_IN_PROFILE.ps1
Last active March 3, 2021 12:23
Make sure you always has GitHub email setup correctly
function Invoke-Git() {
function Get-Email() {
# try finding email from file
$cachedir = "$(Split-Path -Parent $PROFILE)/.github_users"
New-Item -Path $cachedir -ItemType "directory" -Force | Out-Null
$usercache = "$($cachedir)/user_$($env:GITHUB_USER)"
if (Test-Path -Path $usercache) {
Get-Content -Path $usercache
} else {