Skip to content

Instantly share code, notes, and snippets.

View recall704's full-sized avatar
💭
I may be slow to respond.

recall704 recall704

💭
I may be slow to respond.
View GitHub Profile
@lu911
lu911 / database.py
Created October 6, 2015 11:18
database.py
# -*- coding:utf-8 -*-
class LoupQuery(Query):
pass
db_session = scoped_session(
sessionmaker(
autocommit=False,
autoflush=False,
@ChillarAnand
ChillarAnand / celery periodic task example
Created November 22, 2014 08:53
celery periodic task example
from datetime import timedelta
from celery import Celery
from celery.task import periodic_task
app = Celery('tasks', backend='amqp',
broker='amqp://guest@localhost//')
@obenjiro
obenjiro / vertical-text.css
Last active April 4, 2020 20:23
CrossBrowser Vertical CSS Text
/**
* Works everywere ( IE7+, FF, Chrome, Safari, Opera )
* Example: http://jsbin.com/afAQAWA/2/
*/
.rotated-text {
display: inline-block;
overflow: hidden;
width: 1.5em;
}
.rotated-text__inner {
@reorx
reorx / python_deployment.rst
Last active December 14, 2020 03:31
Python Deployment

This document is still a scratch

Python Deployment

Setup A Workplace

You’ll want a directory to do this in so that you don’t screw up your machine.

@bdarnell
bdarnell / streaming.py
Created January 11, 2015 21:23
Demo of streaming requests with Tornado
"""Demo of streaming requests with Tornado.
This script features a client using AsyncHTTPClient's body_producer
feature to slowly produce a large request body, and two server
handlers to receive this body (one is a proxy that forwards to the
other, also using body_producer).
It also demonstrates flow control: if --client_delay is smaller than
--server_delay, the client will eventually be suspended to allow the
server to catch up. You can see this in the logs, as the "client
@clemfromspace
clemfromspace / puppeteer-middleware.py
Last active June 26, 2021 08:02
Scrapy with Puppeteer
"""This module contains the ``SeleniumMiddleware`` scrapy middleware"""
import asyncio
from pyppeteer import launch
from scrapy import signals
from scrapy.http import HtmlResponse
from twisted.internet import defer
from .http import PuppeteerRequest

Run Jupyterlab on docker

Build starting from a Jupyter 2.x image.

Build

docker build -t jupyterlab .
@5car1z
5car1z / do-debian8-locale-issues.md
Last active December 19, 2021 10:57
Debian 8 DO Locale Issues Fix

Debian 8 DO Locale Issues Fix

Problem

"Locale problems" in both the 32-bit & 64-bit versions of Debian 8 droplets

Create a new Debian 8 droplet and login as root:

import wx
#from wx.lib.pubsub.core import Publisher #If you want to manage your own publisher use this
from wx.lib.pubsub import pub
import threading
class ParcelData(object):
def __init__(self,count,current,message):
self.parcel_count = count
self.current_parcel = current
self.message = message
@dbathgate
dbathgate / vpc-ip-address-to-container-amazon.sh
Last active July 7, 2022 14:13
Assign VPC addresses to Docker containers associated as secondary IP addresses to an ENI in AWS
# Description: How to assign VPC addresses to Docker containers associated as secondary IP addresses to an ENI in AWS
# Operating System: Amazon Linux AMI 2016.09.1 (HVM)
# Prerequisites:
# - Assign N number of secondary IP addresses to network interface on Docker host
# - Each new container requires additional assignment of secondary IP addresses
# - Containers can be launched with --net=none to avoid adding a Docker networked NIC (docker run --net=none -d imageId)
# Credit to https://github.com/jpetazzo/pipework for steps on linking IP address
################# Setup Bridge of eth0 ######################
yum install bridge-utils -y