Skip to content

Instantly share code, notes, and snippets.

View zeuxisoo's full-sized avatar
🛥️
No response

Zeuxis zeuxisoo

🛥️
No response
View GitHub Profile
@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
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
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active September 29, 2024 08:31
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@plentz
plentz / nginx.conf
Last active November 14, 2024 08:35
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@konklone
konklone / ssl.rules
Last active October 29, 2024 07:36
nginx TLS / SSL configuration options for konklone.com
# Basically the nginx configuration I use at konklone.com.
# I check it using https://www.ssllabs.com/ssltest/analyze.html?d=konklone.com
#
# To provide feedback, please tweet at @konklone or email [email protected].
# Comments on gists don't notify the author.
#
# Thanks to WubTheCaptain (https://wubthecaptain.eu) for his help and ciphersuites.
# Thanks to Ilya Grigorik (https://www.igvita.com) for constant inspiration.
server {
{
"directory": "components"
}
var cluster = require('cluster');
var PORT = +process.env.PORT || 1337;
if (cluster.isMaster) {
// In real life, you'd probably use more than just 2 workers,
// and perhaps not put the master and worker in the same file.
cluster.fork();
cluster.fork();
cluster.on('disconnect', function(worker) {
@volca
volca / deferred.js
Created December 5, 2012 05:18
promise for node.js
some_fun(req, res, next)
.pipe(function() { return redis.incr('next_id') })
.fail(function(e) { return next(e); })
.pipe(function() { return redis.set('key', {id:r, now:Date.now()}) })
.done(function(res) {res.send([1, 'ok'];})
.fail(function(e) {return next(e); })
@mike-zhang
mike-zhang / rtspTcpClient_DSS.py
Created October 29, 2012 15:31
rtsp TCP Client for DarwinStreamingServer(python)
#! /usr/bin/python
import socket,time,string,random,thread
m_Vars = {
"bufLen" : 1024 * 10,
"defaultServerIp" : "192.168.1.100",
"defaultServerPort" : 554,
"defaultTestUrl" : "rtsp://192.168.1.100/test1.mp4",
"defaultUserAgent" : "LibVLC/2.0.3 (LIVE555 Streaming Media v2011.12.23)"
@luztak
luztak / namere.py
Created July 2, 2012 18:56
RegEx for [at] and urls.
import re
at_user_filter = re.compile(r'(?:^|\W)@(\w+)')
email_filter = re.compile('(\w{1,63})@([A-Za-z0-9\.\-] ).(com|net|org|me|in|fm|co|biz|info|mobi|cc)')
#you can add suffixes by asking Google for domain suffix information.
url_filter = re.compile(u'((http(s|)|ftp)://|)(\w{0,}\.|)(\w{1,63}).(\w{2,4})((/((.*)|)|))')
@fillano
fillano / test782.html
Created April 24, 2012 03:28
worked fine with node-websocket server. websocket now supports both utf8 and binary data frame.
<html>
<body>
<input id="msg" type="text">
<input id="send" type="button" value="send">
<input id="file" type="file">
<div id="panel" style="border:solid 1px #336699"></div>
<div id="info" style="border:solid 1px #336699"></div>
<div id="img"><img id="imgtarget"></div>
</body>
</html>