Skip to content

Instantly share code, notes, and snippets.

View ra101's full-sized avatar
🎯
Status?... Using this emoji to symbolize the irony of hating dart.

Parth Agarwal ra101

🎯
Status?... Using this emoji to symbolize the irony of hating dart.
View GitHub Profile
1.1.1: Enhancement: Details
  • Baz
  • Qux
@ra101
ra101 / get_active_window_exe.py
Created March 29, 2023 11:02
get exe name of foreground window
from os.path import basename as get_base_name
from ctypes import wintypes, windll, create_unicode_buffer, byref
def getActiveWindowExe():
# PROCESS_QUERY_INFORMATION, PROCESS_VM_READ, BUF_LEN = 0x0400, 0x0010, 260
hwnd, pid = windll.user32.GetForegroundWindow(), wintypes.DWORD()
tid = windll.user32.GetWindowThreadProcessId(hwnd, byref(pid))
handle = windll.kernel32.OpenProcess(0x0400 | 0x0010, False, pid)
buf = create_unicode_buffer(260)
windll.psapi.GetModuleFileNameExW(handle, 0, buf, 260)
@ra101
ra101 / 01_Speed_Up_v3.rb
Last active December 12, 2022 14:04
"Better Speed Up" for Pokemon Essentials v20.1
#===============================================================================
# "Better Speed Up" for Pokemon Essentials v20.1
# - Marin: original script
# - Phantombass: updating to 19.1
# - ra101: Adding it in Options
#-------------------------------------------------------------------------------
# - Disable by setting `$game_temp.disable_speed_up` to true
# - Remap your `Q` button on the F1 screen to change your speedup switch
# - Default is now faster than original speed
# - Change line 34 to `@gamespeed = 0 if @gamespeed == nil`
@ra101
ra101 / concat-mp4.py
Last active January 23, 2022 17:12
Concat .mp4 files, using ffmpeg and python
# Output in same dir as script
import os
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog as fd
from tkinter.messagebox import showinfo, askokcancel
def concat():
@ra101
ra101 / constant.py
Last active June 3, 2023 11:54
A different implementation of constant for python
"""
constant.py: A different implementation of constant for python
"""
class ConstantMeta(type):
"""
Meta Class for Constant, How Constant class would behave
"""
def __new__(cls, clsname, bases, clsdict):
@ra101
ra101 / brightness.ps1
Last active March 8, 2022 21:16
Script to control brightness via command
$brightness = (Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightness).CurrentBrightness
if ($args[0] -eq "desc") {
$brightness = (([int]($brightness / 10) * 10 - 10), 0 | Measure -Max).Maximum
}
else {
$brightness = (([int]($brightness / 10) * 10 + 10), 100 | Measure -Min).Minimum
}
(Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1, $brightness)
@ra101
ra101 / alias.sh
Last active March 9, 2024 07:30
exhaustive list of aliases that i use for my dev setup
# Aliases
alias 'cd..'='cd ..'
alias ls='ls -CF'
alias ll='ls -alF'
alias la='ls -ACF'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias sag='sudo apt-get'
@ra101
ra101 / sorting-lists.cpp
Created March 18, 2020 10:43
diff sorting algos on std::list in STL lib C++
#include<iostream>
#include<list>
#include<iterator>
using namespace std;
list<int>::iterator itr1;
list<int>::iterator itr2;
void merge(list<int>&,list<int>::iterator,list<int>::iterator,list<int>::iterator);
void mergeSort(list<int>&);