Skip to content

Instantly share code, notes, and snippets.

// Useful for AES encryption.
// Pad the ciphertext with zeros until it is of length blockSize.
func ZerosPad(ciphertext []byte, blockSize int) []byte {
// determine number of zeros to add
padLen := blockSize - (len(ciphertext) % blockSize)
padText := bytes.Repeat([]byte{0}, padLen)
ciphertext = append(ciphertext, padText...)
usingnamespace @import("bits.zig");
pub const CW_USEDEFAULT: DWORD = 0x80000000;
// https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
pub const WS_OVERLAPPED = 0x00000000;
pub const WS_POPUP = 0x80000000;
pub const WS_CHILD = 0x40000000;
pub const WS_MINIMIZE = 0x20000000;
pub const WS_VISIBLE = 0x10000000;
const gdi32 = @import("gdi32.zig");
pub usingnamespace @import("std").os.windows;
pub const VOID = c_void;
pub const HWND = HANDLE;
pub const WPARAM = UINT_PTR;
pub const LPARAM = LONG_PTR;
pub const LRESULT = LONG_PTR;
pub const HICON = HANDLE;
pub const HCURSOR = HICON;
module multiformattedtext;
/************************************************************************
*
* File: MultiformattedText.cpp
*
* Description:
*
*
* This file is part of the Microsoft Windows SDK Code Samples.
@fourst4r
fourst4r / SparseMatrix.hx
Created August 25, 2023 06:40
SparseMatrix
@:allow(SparseMatrixIterator)
@:allow(SparseMatrixKeyValueIterator)
class SparseMatrix<T> {
final _rows:Array<Int>;
final _cols:Array<Int>;
final _values:Array<T>;
public function new() {
_rows = new Array();
@fourst4r
fourst4r / Twitch-Record.ps1
Created September 8, 2024 12:02
Script to record twitch streams with streamlink (neem's movie night)
param (
[string]$username
)
while ($true) {
$timestamp = [DateTimeOffset]::Now.ToUnixTimeSeconds()
$videosDir = "$env:USERPROFILE\Videos\$username"
if (-not (Test-Path -Path $videosDir)) {