Skip to content

Instantly share code, notes, and snippets.

View iTrooz's full-sized avatar
💭
CODE

iTrooz

💭
CODE
View GitHub Profile
@iTrooz
iTrooz / README.md
Last active August 5, 2022 13:27
Signing Drivers on Windows

// Note : this is a scrapped README edit I did for maharmstone/btrfs#503 We then took another approach

Signing

To install a built-from-source or a nightly (from github actions) driver, you need to sign it In this section, I will show how to disable driver signature enforcement, or how to sign the driver using test-signing Warning : both of these solutions aren't perfect, if you are looking for a everyday-use it is recommanded to use the release builds, which are signed with a Microsoft-trusted key.

@iTrooz
iTrooz / AppRun
Last active December 3, 2022 20:12
AppImage Custom AppRun for multiple executables
#!/bin/sh
# This is a sample AppRun that can be adapted for building your own
# AppDirs. It contains several interesting features, some of which may
# or may not be useful to you.
# Much of the code to build and run the application was taken from
# the AppRun script for ROX-Session, by Thomas Leonard.
# Modified by iTrooz
# INSPIRED BY https://www.skepticats.com/rox/wrappers.html#template
@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:
@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 / main.cpp
Created October 20, 2022 13:04
TCP socket server with multi-client support with poll()
// NOTE : you need the library fmt to format strings
// Command to use : `g++ server.cpp -o server -lfmt`
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <vector>
#include <string>
#include <iostream>
@iTrooz
iTrooz / MainJ8.java
Created November 11, 2022 18:48
modify String object value in Java
public class MainJ8 {
public static void main(String[] args) throws ReflectiveOperationException {
String someVariable = "My String";
String aSecondVariable = "My String";
modifyString("My String", "new value !");
System.out.println(someVariable); // new value
@iTrooz
iTrooz / chatgpt.py
Last active November 7, 2023 09:01
basic ChatGPT terminal client
#!/bin/python3
import sys
from openai import OpenAI
myPrompt = ' '.join(sys.argv[1:]).strip()
if not myPrompt:
print("Syntax : ", sys.argv[0], "prompt")
exit(1)
print("Me:", myPrompt, file=sys.stderr)
@iTrooz
iTrooz / Dockerfile
Last active December 26, 2022 15:49
PoC partial upgrade ArchLinux Dockerfile
# https://gist.github.com/iTrooz/251d085c5fb2d852533c37edcd5f3d08
# PoC a ArchLinux partial upgrade and its damage
# Working as of 2022/12/26, might not work on the future due to ArchLinux repositories changes
# Image from 2022/06/26
FROM archlinux:base-devel-20220626.0.64095
# Try to upgrade all packages, but then cancel
# this also works by running `pacman -Sy`
RUN echo "n" | pacman -Syu || true
@iTrooz
iTrooz / client.py
Created January 4, 2023 10:13
Flask-SocketIO rooms hello world
import socketio
sio = socketio.Client()
sio.connect('http://localhost:5000')
sio.emit('join', {"username": "iTrooz", "room":"myroom"})
@sio.on('chat')
def on_message(data):
@iTrooz
iTrooz / change_authors.py
Last active February 24, 2023 14:22
Randomly change authors in git commits
# !/usr/bin/env python
import sys
import os
import random
authors = (
("user1", "user1@xyz.com"),
("user2", "user2@xyz.com"),
)