Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

timfeirg timfeirg

🌴
On vacation
Block or report user

Report or block timfeirg

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
@timfeirg
timfeirg / unused.sh
Created Sep 25, 2018
analyse unused class and functions (using ag)
View unused.sh
#!/bin/sh
set -e
target_directory=${1-.}
export IFS='
'
for target in $(ag -o '((class|def)\s+(\w+))'); do
target_name=$(echo $target | ag -o '\w+$')
View delete-old-docker-images.sh
#!/bin/env bash
IFS='
'
long_ago=`date +%Y-%m-%d --date='2 weeks ago'`
for image in $(docker images --format '{{.CreatedAt}}|{{.Repository}}:{{.Tag}}')
do
created=`echo ${image%|*} | grep -oP "^[^\s]+"`
tag=${image#*|}
if [ -z "$created" ] || [ -z "$tag" ]; then
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@timfeirg
timfeirg / json_utils.py
Last active Mar 25, 2018
the world's only json encoder that handles buffer message (or grpc message, I don't know)
View json_utils.py
import json
from datetime import datetime
from decimal import Decimal
from flask import Response
from functools import wraps
from google.protobuf.internal import api_implementation
if api_implementation.Type() == 'cpp':
from google.protobuf.pyext.cpp_message import GeneratedProtocolMessageType
@timfeirg
timfeirg / db.py
Last active Dec 19, 2018
scrapy HBase cache storage
View db.py
from datetime import datetime
import happybase
import pymysql
from impala.dbapi import connect as hive_connect
from impala.util import as_pandas
from pymysql.cursors import DictCursor
from retrying import retry
from thriftpy.transport import TTransportException
@timfeirg
timfeirg / sendcloud.py
Created Dec 8, 2015
simple wrapper for sendcloud
View sendcloud.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: sendcloud
Author: timfeirg
Email: liuyifu@ricebook.com
Github: https://github.com/timfeirg/
Description: sendcloud python wrapper
"""
@timfeirg
timfeirg / scrapyd command line program
Created Oct 15, 2014
scrapyd command line program, start scrapyd crawler using a python program
View scrapyd command line program
"""
scrapyd commandline interface, for my own project use
"""
import argparse
import requests
import json
import os
You can’t perform that action at this time.