Skip to content

Instantly share code, notes, and snippets.

@simonw
simonw / recover_source_code.md
Last active May 17, 2024 15:29
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
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
# For iNav 1.6.1
# 2017.03.08
# 一般设置
set inav_auto_mag_decl = ON #自动磁偏角打开
set gps_min_sats = 6 #最小GPS数量
set small_angle = 180 #最大解锁角度,设置为180,飞机在任何角度下都可以解锁
set nav_extra_arming_safety = OFF #打开后飞机在没有GPS或者任何导航相关模式(比如返航、位置保持等)打开的前提下都不会解锁
set fixed_wing_auto_arm = ON #推油门自动解锁
@michaelcurry
michaelcurry / rfc-template.md
Created September 29, 2016 18:07
RFC Template [Markdown]

RFC Template

Feature Name: (fill me in with a unique identity, myawesomefeature)

Type: (feature, enhancement)

Start Date: (fill me in with today's date, YYYY-MM-DD)

Author: (your names)

@comp500
comp500 / big_list_of_modpack_things.md
Last active May 17, 2024 15:20
Big List of Modpack Things

Big List of Modpack Things

Also see the Modrinth Awesome list, and a (probably somewhat outdated) list of curse modpack downloaders at https://gist.github.com/jikuja/f44533a16ad04624c3eb8e99e7a3e494/

This list is a bit outdated in places, but I'm still adding things here so that I don't forget them.

Distribution platforms

Name Type Number of mods/packs Popularity (Similarweb rank) Official launcher Third-party support Open Source backend Author rewards
CurseForge Public 31,000 mods; 38,000 modpacks #1410 Yes Many No Yes
Modrinth Public 2000 mods #79,182 In development ATLauncher, packwiz, pacmc, modweaver Yes Planned
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
#!/bin/bash
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install nvm (Node Version Manager)
echo "Installing nvm..."
@norsec0de
norsec0de / install-pyenv-pipenv-aws-amazon-linux.md
Created April 1, 2022 06:46
Install Pyenv & Pipenv on AWS EC2 (Amazon Linux)

Install Pyenv & Pipenv on AWS EC2 (Amazon Linux)

Installation

Install Dependencies

Pyenv builds Python versions from source and therefore requires all the necessary build dependencies.

sudo yum install gcc zlib-devel bzip2 bzip2-devel patch readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel
@JordanMarr
JordanMarr / DragDropPage.fs
Last active May 17, 2024 15:17
Fable bindings for "react-dnd" using HTML5 provider
module DragDropPage
open Feliz
open Fable.React
open Fable.React.Props
open ReactDND
type Language = {
Name: string
}