Skip to content

Instantly share code, notes, and snippets.

View umaumax's full-sized avatar
🏠
Working from home

umaumax umaumax

🏠
Working from home
View GitHub Profile
@umaumax
umaumax / loader.cpp
Created July 14, 2020 13:51
shared dynamic library loader
#include <dlfcn.h>
#include <cstdio>
#include <iostream>
#include <string>
int main(int argc, char* argv[]) {
if (argc <= 1) {
std::cerr << argv[0] << " <so filepath> [RTLD_NOW|RTLD_LAZY]" << std::endl;
return 1;
@umaumax
umaumax / AdvancedWindowSnap.ahk
Created July 30, 2020 06:15
AdvancedWindowSnap.ahk
/**
* Advanced Window Snap
* Snaps the Active Window to one of nine different window positions.
*
* @author Andrew Moore <andrew+github@awmoore.com>
* @version 1.0
*/
/**
* SnapActiveWindow resizes and moves (snaps) the active window to a given position.
@umaumax
umaumax / display-bright-setting-for-night.ps1
Created September 29, 2020 13:22
display bright setting for night by PowerShell
(Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1,5)
@umaumax
umaumax / clipboard-image-to-file.ps1
Created October 21, 2020 10:46
clipboard image to file by PowerShell
Add-Type -Assembly PresentationCore
$img = [Windows.Clipboard]::GetImage()
if ($img -eq $null) {
Write-Host "You cannnot get image form clipboard!"
Start-Sleep -s 10
Exit
}
Write-Host ("Clipboard image data: {0}x{1} Pixel." -f $img.PixelWidth, $img.PixelHeight)
$data = new-object Windows.Media.Imaging.FormatConvertedBitmap($img, [Windows.Media.PixelFormats]::Rgb24, $null, 0)
@umaumax
umaumax / uBlacklist.txt
Last active August 30, 2022 23:08
uBlacklist urls
*://www.tech-teacher.jp/*
*://programming-study.com/*
*://techacademy.jp/*
*://techplay.jp/*
*://golang.jp/*
*://*.coder.work/*
*://*.ojit.com/*
*://*.stackovernet.com/*
*://*.stackovernet.xyz/*
*://ask.xiaolee.net/*
@umaumax
umaumax / Typora.ahk
Created May 11, 2021 11:36
Typora.ahk
#IfWinActive,ahk_exe Typora.exe
^a::
{
send, {Home}
Return
}
^e::
{
send, {End}
Return
@umaumax
umaumax / ClipBoardUtils.ahk
Last active May 27, 2024 13:41
ClipBoardUtils.ahk (⚠ : save as UTF-8 with BOM)
#Persistent
OnClipboardChange("ClipChanged")
Return
; hook ^+v and send ^+v don't work well...
;^+u:: ; Ctrl + Shift + u
;{
; ; update clipboard as plaintext (clear html format)
; content = %Clipboard%
; Clipboard = %content%
@umaumax
umaumax / clipboard-html.ahk
Last active May 20, 2021 13:29
clipboard-html.ahk (⚠ : save as UTF-8 with BOM)
#Include WinClipAPI.ahk
#Include WinClip.ahk
^+y:: ; Ctrl + Shift + y
{
wc := new WinClip
html = %Clipboard%
; for test
; html = <pre><span style="color:red;">hoge</span></pre>
WinClip.Clear()
@umaumax
umaumax / Terminal.ahk
Created July 18, 2021 05:24
Terminal.ahk
global g_tmux_prefix_access_time := 0
GetCurrentTimeAsMilliSeconds() {
millis := (a_hour * 3600 + a_min * 60 + a_sec) * 1000 + a_msec
Return millis
}
IsTmuxAccess() {
now := GetCurrentTimeAsMilliSeconds()
sub := now - g_tmux_prefix_access_time
@umaumax
umaumax / stress.cpp
Created August 12, 2021 13:10
simple stress command
#include <chrono>
#include <fstream>
#include <iostream>
#include <thread>
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " "
<< "cpu_ratio" << std::endl;
return 1;