Skip to content

Instantly share code, notes, and snippets.

@awhatson
awhatson / msys2_downgrade.py
Last active July 9, 2021 05:00
Helper script for downgrading MSYS2
#!/usr/bin/env python3
from argparse import ArgumentParser
from datetime import datetime, timedelta
from pathlib import Path
import json
import re
import subprocess
import sys
import tempfile
@ErikAugust
ErikAugust / spectre.c
Last active October 7, 2025 15:37
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@CMCDragonkai
CMCDragonkai / winpty-wrapper.sh
Last active April 16, 2023 18:45
Winpty Wrapper Script for Cygwin (Makes Windows Apps work in Cygwin) #cli #windows
#!/usr/bin/env sh
# rename this script to whichever windows executable you want to wrap
# make sure to place this script ahead in the PATH lookup obviously
executable="$(command which --all "$(basename "$0")" | grep --max-count=1 --invert-match "$(realpath --no-symlinks "$0")")"
if [ -t 0 -a -t 1 ]; then
exec winpty "$(realpath "$executable")" "$@"
@shinchiro
shinchiro / packages.txt
Last active December 22, 2022 04:39
Missing Cygwin/MSYS2 packages
1. Install re2c
git clone --depth 1 https://github.com/skvadrik/re2c.git
./autogen.sh
./configure --prefix=/usr
make && make install
2. Install ninja
git clone --depth 1 https://github.com/ninja-build/ninja.git
./configure.py --bootstrap
mv ninja.exe /usr/bin
@samhocevar
samhocevar / gist:00eec26d9e9988d080ac
Last active October 17, 2024 17:02
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
#!/bin/sh
URL=$1
CHANNELS=$(echo $URL | sed -e 's/http:\/\/multitwitch.tv\///g')
IFS="/"
for CHANNEL in $CHANNELS; do
livestreamer twitch.tv/$CHANNEL best &
done
@strayer
strayer / youtube-dl-dash.bash
Last active March 24, 2021 18:00
youtube-dl wrapper script to download DASH Video and Audio and combine it with ffmpeg with automatic best format detection and fallback to default youtube-dl behaviour for videos without DASH
#!/usr/bin/env bash
set -e
YOUTUBE_FORMATS=$(youtube-dl -F "$1")
if [[ "$YOUTUBE_FORMATS" == *"(DASH Video)"* ]]; then
VIDEO_NAME=$(youtube-dl --get-filename "$1")
VIDEO_NAME_TMP="$VIDEO_NAME.tmp"
echo "Filename: $VIDEO_NAME"
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active October 18, 2025 07:55
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname