Skip to content

Instantly share code, notes, and snippets.

View pydsigner's full-sized avatar

Daniel Foerster pydsigner

View GitHub Profile
@simonw
simonw / recover_source_code.md
Last active June 21, 2024 00:11
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
static PyObject*
surf_blit_list (PyObject* self, PyObject* args)
{
SDL_Surface *src, *dest = PySurface_AsSurface (self);
GAME_Rect *src_rect, temp;
PyObject *srcobject, *argrect = NULL;
SDL_Rect dest_rect, sdlsrc_rect;
int result;
@ruario
ruario / standalone-vivaldi.md
Last active April 16, 2024 01:54
Unpacks a Vivaldi Linux browser package into a version named directory and creates a startup script that will cause it to save its profile within this directory—Useful for testing or standalone (portable) installs.

Disclaimer: I wrote this script for my own personal use. Completely unofficial and unsupported by Vivaldi Technologies. However, others are welcome to use it at their own risk.

This script converts a Vivaldi browser Linux package into standalone, self-contained install. It lets you use the rpm and deb packages in a similar way to how people generally used the old Opera (Presto) tar packages—for quick testing, without committing to a full, system-wide install. This could be used for testing a specific setup or version, without touching the system wide settings (profile). It can also be used to create a portable (USB install) of Vivaldi that you could store on an external disk, for sharing between computers. A script that supports integration with the desktop environment is also provided.

Usage example:

sh standalone-vivaldi.sh vivaldi-snapshot-1.7.702.1-1.x86_64.rpm

When the script is done you will have a suitably version named directory.

@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: