Skip to content

Instantly share code, notes, and snippets.

View iTrooz's full-sized avatar
💭
CODE

iTrooz

💭
CODE
View GitHub Profile
@iTrooz
iTrooz / to_tldr.py
Created January 26, 2024 21:24
Check commands that you can add to tldr
#!/usr/bin/env python3
# This script will check for commands that you could most easily contribute to tldr (https://tldr.sh/)
# Run it in the root of the https://github.com/tldr-pages/tldr repository
import os
import sys
def get_used_commands():
used_cmds = {}
for filepath, complex in {"~/.zsh_history": True, "~/.bash_history": False}.items():
with open(os.path.expanduser(filepath), "rb") as file:
@reinhrst
reinhrst / Dockerfile
Created November 4, 2023 04:05
emscripten for arm64 / aarch64 Docker container
FROM debian
RUN apt-get update && apt-get install -y git xz-utils python3 curl && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/emscripten-core/emsdk.git && cd /emsdk && ./emsdk install latest-arm64-linux && ./emsdk activate latest-arm64-linux
ENTRYPOINT ["/emsdk/docker/entrypoint.sh"]
@iTrooz
iTrooz / .zshrc
Last active September 19, 2023 07:58
initdir
# rm -rf but with safeguards, and cd into the directory
# You should put this in a sourced script (e.g .bashrc, .zshrc, etc...)
RED="\e[1;31m"
ORANGE="\e[38;5;208m"
GREEN="\e[38;5;2m"
RESET="\e[0;0m"
function initdir() {
if [ $# -eq 0 ]; then
@iTrooz
iTrooz / tmate.yml
Last active February 20, 2023 15:49
TMate workflow
# license: CC0 / public domain
# https://gist.github.com/iTrooz/4dd70aea9debf80a59f3491601b40a26
# feel free to use !
name: TMate
on:
workflow_dispatch:
inputs:
runner:
@reveng007
reveng007 / tracing.md
Last active November 23, 2022 15:07
strace vs. ltrace. vs. ptrace. ftrace

TL'DR:


  1. strace : sytemcall tracer : Traces system call summoned by a process from syscall table

System calls, Eg:

open syscall (__NR_open),
kill syscall (__NR_kill), 
getdents64 syscall (__NR_getdents64), 
@lbrame
lbrame / archtweaks.md
Last active April 6, 2024 05:16
Tweaks I've made to my Arch Linux installation

Arch Linux tweaks

This is a collection of the tweaks and modification I've made to my Arch Linux installation over the months. These may be applicable to other distros, but please check first before doing anything. I also included Arch Wiki references for all the procedures I mentioned. My recommendation is not to blindly follow this gist but to always check with the Arch Linux wiki first. Things move fast and by the time you're reading this my gist may be out of date. Lastly, the golden rule: never execute a command you don't understand.

Installing the KDE Plasma desktop

My current DE of choice is KDE's Plasma. I find it just about perfect.

There are various ways to install it on Arch. The most popular one is to install plasma and plasma-applications, but I don't like doing that because it comes with too many programs I'll never use. I, instead, install the base plasma group, remove the few extra packages that come with it, then I finish off by installing a few KDE apps that don't come with th

msys2 vs msys vs msysgit
MinGW doesn't provide a linux-like environment, that is MSYS(2) and/or Cygwin
Cygwin is an attempt to create a complete UNIX/POSIX environment on Windows.
MinGW is a C/C++ compiler suite which allows you to create Windows executables - you only
need the normal MSVC runtimes, which are part of any normal Microsoft Windows installation.
MinGW provides headers and libraries so that GCC (a compiler suite,
not just a "unix/linux compiler") can be built and used against the Windows C runtime.
@Pagliacii
Pagliacii / win_api_test.py
Last active February 25, 2024 20:40
Use ctypes to call WIndows API
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import ctypes
import os
from ctypes import windll, wintypes
from typing import Optional
NULL: int = 0
@dpino
dpino / ns-inet.sh
Last active April 19, 2024 18:12
Setup a network namespace with Internet access
#!/usr/bin/env bash
# set -x
if [[ $EUID -ne 0 ]]; then
echo "You must be root to run this script"
exit 1
fi
# Returns all available interfaces, except "lo" and "veth*".
@jazzycamel
jazzycamel / threads1.py
Last active March 29, 2023 21:49
Simple example of the correct way to use (Py)Qt(5) and QThread
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from itertools import count, islice
class Threaded(QObject):
result=pyqtSignal(int)
def __init__(self, parent=None, **kwargs):
super().__init__(parent, **kwargs)