Skip to content

Instantly share code, notes, and snippets.

View an9er's full-sized avatar

gcj an9er

View GitHub Profile
@toolness
toolness / adventures-in-python-core-dumping.md
Last active July 3, 2024 01:45
Adventures in Python Core Dumping

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

@Sg4Dylan
Sg4Dylan / getLiveComment.py
Last active February 14, 2018 05:04
简单的Bilibili直播弹幕抓取实现
#!/usr/bin/env python
import socket
import binascii
import threading
import time
import json
reconnect_flag = 0
@nuria
nuria / celery_before_after.py
Last active October 22, 2021 21:19
Handlers that execute right before and right after a task is executed in celery.
from celery import Celery
from celery.signals import after_task_publish,task_success,task_prerun,task_postrun
# first argument, current module
app = Celery('tasks')
app.config_from_object('celeryconfig')
# To instantiate celery and import this module
# do: celery -A task worker --loglevel=info
# after, once celery is running, instantiate a python console:
@mxpr
mxpr / dashing-requests.py
Created December 15, 2013 17:22
Example of how to send data to dashing from python
# http://stackoverflow.com/questions/20211990/sending-data-curl-json-in-python
import requests #pip install requests
import simplejson as json #pip install simplejson
url = "http://<ip-address>:3030"
widget = "welcome"
data = { "auth_token": "YOUR_AUTH_TOKEN", "text": "Python Greetings!!" }
fullUrl = "%s/widgets/%s" % (url, widget)
@alexzhou
alexzhou / circle_progressbar_canvas.html
Last active August 26, 2016 08:37
使用canvas 画环形进度条
<!DOCTYPE html>
<html>
<head>
<title>circle progressbar</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var range = $('#range');
var bg = $('#counter');
var ctx = bg[0].getContext('2d');
@sloria
sloria / bobp-python.md
Last active September 8, 2024 09:08
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@mislav
mislav / _readme.md
Last active June 28, 2024 15:16
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@quexer
quexer / jQuery-plugin-authoring.md
Created September 4, 2012 09:42
如何编写 jQuery 插件

创建插件


看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。

开始

@toolness
toolness / gencert.py
Last active June 22, 2023 11:52
Python script to create server SSL certs and sign them with a custom CA.
#! /usr/bin/python
"""
This simple script makes it easy to create server certificates
that are signed by your own Certificate Authority.
Mostly, this script just automates the workflow explained
in http://www.tc.umn.edu/~brams006/selfsign.html.
Before using this script, you'll need to create a private