Skip to content

Instantly share code, notes, and snippets.

View http_log.py
from argparse import ArgumentParser
from collections import defaultdict
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('input', type=str)
args = parser.parse_args()
View host.py
from argparse import ArgumentParser
import socket
def dns_lookup(hostname: str) -> str:
return socket.gethostbyname(hostname)
if __name__ == '__main__':
parser = ArgumentParser()
@renexu
renexu / build_libvips.md
Created Jan 24, 2019
build latest libvips deb on ubuntu 18.04
View build_libvips.md

These are the steps to build latest libvips (8.7.4) deb package on ubuntu 18.04

##1. install build scripts

# sudo apt install build-essential devscripts

##2. download vips source

@renexu
renexu / train.py
Created Dec 28, 2017
Keras HDF5Matrix and fit_generator for huge hdf5 dataset
View train.py
import threading
from keras.applications.inception_v3 import InceptionV3
from keras.optimizers import Adam
from keras.utils.io_utils import HDF5Matrix
class threadsafe_iter:
"""Takes an iterator/generator and makes it thread-safe by
serializing call to the `next` method of given iterator/generator.
@renexu
renexu / kafka
Last active Sep 21, 2016 — forked from superscott/kafka
Simple Kafka Ubuntu init.d Startup Script
View kafka
#! /bin/sh
### BEGIN INIT INFO
# Provides: kafka
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: A high-throughput distributed messaging system.
# Description: Kafka is a distributed, partitioned, replicated commit log service.
View iparesign
#!/usr/bin/env bash
if [[ ! ( # any of the following are not true
# 1st arg is an existing regular file
-f "$1" &&
# ...and it has a .ipa extension
"${1##*.}" == "ipa" &&
# 2nd arg is an existing regular file
-f "$2" &&
# ...and it has an .mobileprovision extension