Skip to content

Instantly share code, notes, and snippets.

💔
PrayForKyoani

laike9m laike9m

💔
PrayForKyoani
Block or report user

Report or block laike9m

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thirtythreeforty
thirtythreeforty / tcphole.py
Last active Aug 29, 2015
A TCP hole puncher
View tcphole.py
#!/usr/bin/python3
# tcphole.py
# By George Hilliard ("thirtythreeforty")
# A simple TCP hole puncher for a firewall accepting only ESTABLISHED,RELATED packets
# This currently binds to the localhost address, although that's easy to fix by changing
# the bind() calls.
# This is based on the theory found at http://www.bford.info/pub/net/p2pnat/index.html#sec-tcp.
# You may use this software under the terms of the Creative Commons CC-0 license.
View pyvideo_popularity.py
#!/usr/bin/env python3
# encoding: utf-8
"""
I saw a similar script on the homepage of Miguel Grinberg (the Flask book guy),
but he was using webscraping. Here I use simple API calls instead.
The script takes the presentations of a Python conference and orders the
presentations in descending order by the number of youtube views. It
is an indicator about the popularity of a video.
View gist:26fb3b7e365dce527886
Results of running this script: https://gist.github.com/jabbalaci/398429347c96e98aba88
Views Ups Downs Title (Speakers)
9,810 166 3 Keynote - Jacob Kaplan-Moss - Pycon 2015 (Jacob Kaplan-Moss)
7,044 64 0 Type Hints - Guido van Rossum - PyCon 2015 (Guido van Rossum)
4,742 121 0 David Beazley - Python Concurrency From the Ground Up: LIVE! - PyCon 2015 (David Beazley)
4,684 66 3 Keynote - Guido van Rossum - PyCon 2015 (Guido van Rossum)
4,272 78 1 Dan Callahan - My Python's a little Rust-y - PyCon 2015 (Dan Callahan)
2,694 34 0 How to build a brain with Python (Trevor Bekolay)
2,391 29 0 Andrew T. Baker - Demystifying Docker - PyCon 2015 (Andrew T. Baker)
@vsajip
vsajip / custfmt.py
Created Feb 9, 2012
Example of logging formatter factory usage with fileConfig()
View custfmt.py
import logging
class CustomFormatter(logging.Formatter):
def __init__(self, default):
self.default = default
def format(self, record):
if record.levelno in (logging.WARNING,
logging.ERROR,
logging.CRITICAL):
@davesque
davesque / vassal.ini
Created Jan 7, 2013
Uwsgi ini file for django
View vassal.ini
[uwsgi]
socket = /tmp/example.com.sock
; Worker processes
master = 1
processes = 4
; Virtualenv and home directory
virtualenv = /var/virtualenvs/example.com
chdir = /var/www/example.com
View stackify.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mbostock
mbostock / .block
Last active Apr 30, 2019
Force-Directed Graph
View .block
license: gpl-3.0
height: 600
redirect: https://observablehq.com/@d3/d3-force-directed-graph
@koenbollen
koenbollen / punch.py
Created Jul 5, 2010
Proof of Concept: UDP Hole Punching
View punch.py
#!/usr/bin/env python
#
# Proof of Concept: UDP Hole Punching
# Two client connect to a server and get redirected to each other.
#
# This is the client.
#
# Koen Bollen <meneer koenbollen nl>
# 2010 GPL
#
@mbostock
mbostock / .block
Last active Sep 6, 2019 — forked from mbostock/.block
Radial Cluster Dendrogram
View .block
license: gpl-3.0
height: 950
border: no
@zyxar
zyxar / exercise.tour.go
Created Apr 6, 2012
tour.golang exercise solutions
View exercise.tour.go
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
You can’t perform that action at this time.