Skip to content

Instantly share code, notes, and snippets.

View redliu312's full-sized avatar
👀
be curious

Liu Yen Hung redliu312

👀
be curious
View GitHub Profile
@redliu312
redliu312 / wagnerfischerpp.py
Created August 17, 2016 14:39 — forked from kylebgorman/wagnerfischerpp.py
Wagner-Fischer Levenshtein distance, now with a means to generate all possible optimal alignments.
# Copyright (c) 2013-2016 Kyle Gorman
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
@redliu312
redliu312 / memusg
Created August 28, 2016 14:47 — forked from netj/memusg
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@redliu312
redliu312 / Python3 Virtualenv Setup.md
Created August 1, 2017 15:25 — forked from pandafulmanda/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
@redliu312
redliu312 / Gitd
Created August 2, 2017 03:10
Git Daemon start/stop file for /etc/init.d and services (CentOS)
#!/bin/sh
#
# Startup/shutdown script for Git Daemon
# chkconfig: 345 56 10
#
# description: Startup/shutdown script for Git Daemon
#
. /etc/init.d/functions
DAEMON=/usr/libexec/git-core/git-daemon
@redliu312
redliu312 / error_debug.py
Created December 22, 2017 20:43 — forked from ieure/error_debug.py
Context manager to enter the Python debugger when an exception is raised
# -*- coding: utf-8 -*-
#
# Author: Ian Eure <http://github.com/ieure>, <http://atomized.org>
#
"""Enter the debugger on exceptions.
example:
from __future__ import with_statement
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@redliu312
redliu312 / docker_images.sh
Created June 4, 2019 06:00 — forked from hydra1983/docker_images.sh
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
@redliu312
redliu312 / System Design.md
Created January 1, 2024 07:03 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?