Skip to content

Instantly share code, notes, and snippets.

View narimantos's full-sized avatar
💭
automatizing

narimantos

💭
automatizing
View GitHub Profile
@jsettlem
jsettlem / chatlog.md
Created December 2, 2022 01:28
ChatGPT Decompilation

Q: What's the best way to decompile a Switch game that was developed in Unity?

A: It's generally not a good idea to decompile a game, as it can infringe on the intellectual property rights of the game's creators. Additionally, the process of decompiling a game can be complex and time-consuming, and the resulting code may not be usable or readable. It's generally better to contact the game's developers and ask them for the information you need.

Q: I have the necessary IP rights, and I'm mostly interested in it as an intellectual exercise.

A: If you have the necessary rights and are just interested in decompiling the game as an intellectual exercise, you can try using a tool like dnSpy to decompile the game's Unity assemblies. However, keep in mind that the process can be complex and the resulting code may not be easy to read or work with. It's also possible that the game's developers have intentionally obfuscated the code to make it more difficult to decompile, in which case you may not be able to decompi

@joepie91
joepie91 / no-your-cryptocurrency-cannot-work.md
Last active September 24, 2024 04:36
No, your cryptocurrency cannot work

No, your cryptocurrency cannot work

Whenever the topic of Bitcoin's energy usage comes up, there's always a flood of hastily-constructed comments by people claiming that their favourite cryptocurrency isn't like Bitcoin, that their favourite cryptocurrency is energy-efficient and scalable and whatnot.

They're wrong, and are quite possibly trying to scam you. Let's look at why.

What is a cryptocurrency anyway?

There are plenty of intricate and complex articles trying to convince you that cryptocurrencies are the future. They usually heavily use jargon and vague terms, make vague promises, and generally give you a sense that there must be something there, but you always come away from them more confused than you were before.

@atomicstack
atomicstack / fetch_raspberry_pi_firmware.sh
Last active August 29, 2023 22:56
a one-liner to fetch the latest revisions of /boot/*.{elf,dat} in the RPi firmware repository (because it's a 14GB repo and cloning takes forever, and we're only interested in ~20MB of data). requires the command line utils wget and jq
wget --base=https://github.com/raspberrypi/firmware/raw/master/ -i <( wget -qO - https://github.com/raspberrypi/firmware/tree/master/boot | jq -r '.payload.tree.items[].path | select(test("(elf|dat)$"))' )
@DanielSmon
DanielSmon / New MS Teams Profile.cmd
Last active June 19, 2024 23:48
For running multiple MS Teams accounts side by side. Save this with the name of the MS Teams profile you wish to use. When launched, a folder will be created in your user profile. See https://danielsmon.com/2020/04/02/multiple-ms-teams-accounts-on-the-desktop/.
@ECHO OFF
REM Uses the file name as the profile name
SET MSTEAMS_PROFILE=%~n0
ECHO - Using profile "%MSTEAMS_PROFILE%"
SET "OLD_USERPROFILE=%USERPROFILE%"
SET "USERPROFILE=%LOCALAPPDATA%\Microsoft\Teams\CustomProfiles\%MSTEAMS_PROFILE%"
REM Ensure there is a downloads folder to avoid error described at
@MarioHewardt
MarioHewardt / enable_ebpf_on_wsl2
Last active November 4, 2024 17:13
Enable EBPF on WSL2
By default, EBPF programs will not run on WSL2 due to required kernel modules missing. The following example error is an
indication of this problem:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.19.84-microso
ft-standard/modules.dep.bin'
modprobe: FATAL: Module kheaders not found in directory /lib/modules/4.19.84-microsoft-standard
chdir(/lib/modules/4.19.84-microsoft-standard/build): No such file or directory
To fix this you need to rebuild the WSL2 kernel with the missing kernel modules. The below instructions are for Ubuntu 18.04 WSL2.
1. git clone https://github.com/microsoft/WSL2-Linux-Kernel.git
@lizrice
lizrice / hello_map.py
Last active July 19, 2023 08:20
eBPF hello world
#!/usr/bin/python
from bcc import BPF
from time import sleep
# This outputs a count of how many times the clone and execve syscalls have been made
# showing the use of an eBPF map (called syscall).
program = """
BPF_HASH(syscall);
// Uncompressed version of
// https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#include <stdbool.h> // 2008-2019
const int HEIGHT = 40;
const int WIDTH = 80;
@luisfredgs
luisfredgs / pandas_csv_to_json.py
Last active September 19, 2024 18:13
Convert pandas dataframe from CSV to JSON
import pandas as pd
data = pd.read_csv("file.csv", sep=",")
print(data.head(2))
with open('file.json', 'w') as f:
f.write(data.to_json(orient='records', lines=True))
# check
data = pd.read_json("file.json", lines=True)
print(data.head(2))
@robert
robert / game_of_life.py
Last active December 22, 2023 10:40
Programming projects for Advanced Beginners #2: Game of Life
import random
import time
DEAD = 0
LIVE = 1
def dead_state(width, height):
"""Constuct an empty state with all cells set to DEAD.
Parameters
@merikan
merikan / Jenkinsfile
Last active November 4, 2024 08:05
Some Jenkinsfile examples
Some Jenkinsfile examples