Skip to content

Instantly share code, notes, and snippets.

View woozyking's full-sized avatar

Runzhou Li (Leo) woozyking

View GitHub Profile
@woozyking
woozyking / v1.py
Last active December 19, 2015 06:58
Tame PycURL
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pycurl
def iter_chunks(data, delimiter):
chunks = data.split(delimiter)
for chunk in chunks:
@woozyking
woozyking / setup.sh
Created October 22, 2013 05:14
Ubuntu Docker Dev Env
#!/bin/bash
# First step we update and upgrade
sudo apt-get update && sudo apt-get upgrade -y
# Second step install git as it's almost always needed nowadays
sudo apt-get install git -y
(cd /tmp && git clone --depth 1 https://github.com/visionmedia/git-extras.git && cd git-extras && sudo make install)
# For Docker
@woozyking
woozyking / master.sh
Last active January 2, 2016 14:49
CentOS Disco Deplyment
#!/bin/bash
DISCO_USER=disco
# Update and clean cache
yum clean all -y
# Add EPEL repo
# http://wiki.centos.org/AdditionalResources/Repositories
# http://fedoraproject.org/wiki/EPEL
@woozyking
woozyking / cache_mongo_ids.py
Last active December 23, 2019 22:38
Cache MongoDB Document IDs in Redis SET with Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pymongo import MongoClient
from bson import ObjectId
import redis
def cache_ids(db, cache, cache_key, reset=True, limit=1000):
if reset:
@woozyking
woozyking / push_to_deploy.sh
Last active March 22, 2018 18:53
Git push to deploy leveraging Linux user:group as a "container/sandbox"
#!/usr/bin/env bash
#######################################################
# Git Based Push to Deploy Env Setup
# To Use:
# ./push_to_deploy.sh <name of user> [optional crontab]
#######################################################
set -e
@woozyking
woozyking / node_setup.sh
Last active February 17, 2016 21:02
node env setup
# see https://nodejs.org/en/download/package-manager/ to get node.js installed
# install forever globally
sudo npm install -g forever
@woozyking
woozyking / count_queue.py
Last active March 12, 2016 02:47
techies examples
from techies import CountQueue
q = CountQueue(key='demo_q', host='localhost', port=6379, db=0)
# put, or enqueue
q.put('lol')
q.put('dota')
q.put('skyrim')
q.put('dota') # increment the count of the existing 'dota'

Keybase proof

I hereby claim:

  • I am woozyking on github.
  • I am woozyking (https://keybase.io/woozyking) on keybase.
  • I have a public key ASAprXeE_RHmCRhWbtYMJpOwyVAhlIFYxit8wfdZvEMUCAo

To claim this, I am signing this object:

@woozyking
woozyking / dear-diary.md
Created March 16, 2020 19:55
dev-journal-diary

Dear Diary,

Yesterday, I did yet another batch of GAM segments upload, and re-re-mirrored swarm repo, again.

But enough with the chores, let me share with you something more exciting!

I finally further automated the GAM segment upload process to source newly submitted jobs from segment_gam data table. Even better, now OPs have learned to use the already built (albeit hidden) LOCUS UI (/segments-gam, and /segments-gam-list) to input the GAM List ID and Segment pairs. 100% win-win for all!

On the front-end of LOCUS (snoke), I finally completed this iteration of builder view job redesign implementation, as well as the builder list redesign follow-up issue (snoke#703). At last, the crawling is over.

(some repo) % npx @eqworks/commit-watch -b origin/main --verbose
⚠ 6/9 do not match pattern "category[/sub-category] - subject title"
✖ define APIError
✖ fix /readme to reflect changes in selectUser
✖ remove unnecessary await
✖ refactor selectUser to return user || undefined
✖ PR fixes, throws APIError
✖ check if user exists, won't send opt email if user unknown
✓ users - make getUsers async, await db query