Skip to content

Instantly share code, notes, and snippets.

View GitHub30's full-sized avatar
🌴
On vacation

GitHub30

🌴
On vacation
  • Osaka, Japan
View GitHub Profile
function toBaseN(num, base) {
if (num === 0) {
return '0';
}
var digits = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var len = Math.min(digits.length, base);
var result = '';
while (num > 0) {
result = digits[num % len] + result;
num = parseInt(num / len, 10);
@GitHub30
GitHub30 / n2.py
Last active August 7, 2022 08:32 — forked from MarcAlx/notification.py
Send Windows notifications from python3
import winsdk.windows.ui.notifications as notifications
import winsdk.windows.data.xml.dom as dom
from winsdk.windows.ui.notifications import ToastActivatedEventArgs, ToastDismissedEventArgs, ToastFailedEventArgs
# create notifier
nManager = notifications.ToastNotificationManager
notifier = nManager.create_toast_notifier()
# define your notification as string
tString = """
@GitHub30
GitHub30 / Toast-RTEvent-Example.ps1
Last active August 17, 2022 03:28 — forked from Windos/Toast-RTEvent-Example.ps1
Example of trying to register a Windows RT event via PowerShell, specifically here we're looking at events on Toast Notifications
$XmlString = @"
<toast>
<visual>
<binding template="ToastGeneric">
<text>Default Notification</text>
<image src="C:\Windows\IdentityCRL\WLive48x48.png" placement="appLogoOverride" />
</binding>
</visual>
<audio src="ms-winsoundevent:Notification.Default" />
</toast>
@GitHub30
GitHub30 / PowerShellUICulture.ps1
Last active October 1, 2022 12:20 — forked from sunnyone/PowerShellUICulture.ps1
Changing PowerShell UICulture
PS C:\Users\Admin> [Threading.Thread]::CurrentThread.CurrentUICulture
LCID Name DisplayName
---- ---- -----------
1041 ja-JP ζ—₯本θͺž (ζ—₯本)
# example: Set-PowerShellUICulture -Name "en-US"
function Set-PowerShellUICulture {
param([Parameter(Mandatory=$true)]
@GitHub30
GitHub30 / get_random_bytes.js
Created May 8, 2023 10:55 — forked from alexdiliberto/get_random_bytes.js
Get random bytes in Javascript (Browser/Node)
let getRandomBytes = (
(typeof self !== 'undefined' && (self.crypto || self.msCrypto))
? function() { // Browsers
var crypto = (self.crypto || self.msCrypto), QUOTA = 65536;
return function(n) {
var a = new Uint8Array(n);
for (var i = 0; i < n; i += QUOTA) {
crypto.getRandomValues(a.subarray(i, i + Math.min(n - i, QUOTA)));
}
return a;