Skip to content

Instantly share code, notes, and snippets.

@rixtox
rixtox / consts.cpp
Created January 29, 2024 05:41
WinRT HTTP example in (almost) pure C
#define INITGUID
#include <guiddef.h>
#include <windows.web.http.h>
extern "C" {
const IID IID_IUnknown = __uuidof(IUnknown);
const IID IID___x_ABI_CWindows_CWeb_CHttp_CIHttpClient = __uuidof(ABI::Windows::Web::Http::IHttpClient);
const IID IID___x_ABI_CWindows_CWeb_CHttp_CIHttpClientFactory = __uuidof(ABI::Windows::Web::Http::IHttpClientFactory);
const IID IID___x_ABI_CWindows_CWeb_CHttp_CIHttpRequestMessageFactory = __uuidof(ABI::Windows::Web::Http::IHttpRequestMessageFactory);
const IID IID___x_ABI_CWindows_CWeb_CHttp_CIHttpMethodFactory = __uuidof(ABI::Windows::Web::Http::IHttpMethodFactory);
#!/usr/bin/env bash
# Install Git and Golang toolchain
function gdir_env_install_pkgs
{
if [ -x "$(command -v xcode-select)" ]; then
xcode-select --install
fi
@rixtox
rixtox / gif2mp4
Last active September 14, 2019 15:54
Converts GIF to MP4 optimized for Telegram
#!/usr/bin/env bash
# Author: Rix
# Version: 0.0.1
set -eu -o errexit -o pipefail -o nounset
function print_usage {
echo 'Usage: gif2mp4 [-c] <[-r] INPUT> ...'
echo ' -c, --concat <OUTPUT> concat all inputs into single MP4'
Verifying my Blockstack ID is secured with the address 1JQ7aPR8WgdNci3nECrWidKgoeBLg5xR2t https://explorer.blockstack.org/address/1JQ7aPR8WgdNci3nECrWidKgoeBLg5xR2t
[System.IO.File]::WriteAllText('out.ass', [System.IO.File]::ReadAllText('in.ass', [System.Text.Encoding]::GetEncoding('gb2312')), [System.Text.Encoding]::GetEncoding('utf-8'))
List of Encoding values:
[System.Text.Encoding]::GetEncodings()
Get-ChildItem .\* -Include *.ass | Rename-Item -NewName { $_.Name -replace '^.*?(\d+).*(\.\w+)$','$1$2' }
@rixtox
rixtox / larger.s
Last active October 27, 2016 15:07
.data
scanf_fmt:
.asciz "%d"
printf_fmt:
.asciz "%d\n"
.text
.global main
main:
// USB Vendor ID: 0x05AC
// USB Product ID: 0x0251
/* The upper label indicates the key's function.
* The lower label indicates the USB/HID Keyboard report value.
* The keyboard report (endpoint 0x81) has the following data structure:
* ```
* struct kdb_report {
* uint8_t modifier;
* uint8_t reserved;
#!/bin/zsh
# ------------------------------------------------------------------
# [Rix] Bemuse.ninja BMS Convertor
# Converts the Japanese encoded BMS and reorder folders.
# ------------------------------------------------------------------
VERSION=0.1.0
SUBJECT=bemuse
USAGE="Usage: bemuse DIR"
#!/bin/bash
if [ -z "$1" ]; then
SRC="."
else
SRC="$1"
fi
if [ -z "$2" ]; then
ENCODING="gb18030"