Skip to content

Instantly share code, notes, and snippets.

@simonw
simonw / recover_source_code.md
Last active May 21, 2024 08:14
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@rutcreate
rutcreate / README.md
Last active May 21, 2024 08:13
Install Python 3.10.x on Ubuntu 20.04

Prerequisite

sudo apt update
sudo apt install software-properties-common -y

Add custom APT repository

@hbldh
hbldh / keyconv.py
Last active May 21, 2024 08:12
Convert a ssh-keygen public key to XML format for C# use.
def convert_openssh_key_to_xml(key, verbose=False):
"""Convert Public Key to XML format for C# usage.
See http://stackoverflow.com/a/13104466 for details.
.. code-block: python
>>> public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDz[...]"
>>> xml_public_key = convert_openssh_key_to_xml(public_key, verbose=True)
>>> print(xml_public_key)
@VityaSchel
VityaSchel / README.md
Last active May 21, 2024 08:12
Example of reading another process memory in Go without knowing base address

You can find explanation here: https://stackoverflow.com/questions/71716646/golang-calculate-address-of-another-process-memory-based-on-process-handle-and-o/72674927#72674927 This is actually my answer posted by my friend because SO doesn't allow you to reclaim your own bounty :)

It's not perfect because I don't know Go and you can definetely replace windows.OpenProcess with kernel32.OpenProcess but I'm too tired to experiment. It just works!

Also keep in mind that this code only works if you have running TJoC:R game running, because I was writing it for my trainer . You should change process name and addresses if you know how to do that. Otherwise, feel free to copy any part of code and use it.

@pisarukv
pisarukv / read.go
Last active May 21, 2024 08:08
read.go
package docker
import (
"context"
"io"
"github.com/ory/dockertest"
"github.com/ory/dockertest/docker"
)
@mrousavy
mrousavy / MEMOIZE.md
Last active May 21, 2024 08:06
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
/*
Mesh Simplification
(C) by Sven Forstmann in 2014
derived from: https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification
and: https://github.com/timknip/mesh-decimate/blob/master/src/simplify.js
License : MIT
http://opensource.org/licenses/MIT
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.AI;
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@charlesaloaye
charlesaloaye / gist:d5234275c8ed0bb4510ffaa9670d80aa
Last active May 21, 2024 08:04
2024 JETBRAINS ACTIVATION CODE | PHPSTORM | PYCHARM | Expires October 14, 2024
I2A0QUY8VU-eyJsaWNlbnNlSWQiOiJJMkEwUVVZOFZVIiwibGljZW5zZWVOYW1lIjoiVU5JVkVSU0lEQURFIEVTVEFEVUFMIERFIENBTVBJTkFTIiwiYXNzaWduZWVOYW1lIjoiVGFvYmFv77yaSkVU5YWo5a625qG25r+AIOa0u+W3peS9nOWupCAgcmVuIHpodW4gZGlhbiBtaW5n77yBIiwiYXNzaWduZWVFbWFpbCI6IlJvYmJ5X1dlbmlnZXJAb3V0bG9vay5jb20iLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAyNC0xMC0xNCIsImV4dGVuZGVkIjpmYWxzZX0seyJjb2RlIjoiREIiLCJwYWlkVXBUbyI6IjIwMjQtMTAtMTQiLCJleHRlbmRlZCI6Z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