Posts

Showing posts from 2017

[Level 1] Lost and Found in git

Once you get lost in git and you could try to find it by the following commands $ git fsck --lost-found $ git reset HEAD@{1} Wish this helps. regards, Stanley Huang

[Level 1] Reversion of git

Just read an article mentioned about the reversions of git, so take a note here. G H I J \ / \ / D E F \ | / \ \ | / | \|/ | B C \ / \ / A A = = A^0 B = A^ = A^1 = A~1 C = A^2 = A^2 D = A^^ = A^1^1 = A~2 E = B^2 = A^^2 F = B^3 = A^^3 G = A^^^ = A^1^1^1 = A~3 H = D^2 = B^^2 = A^^^2 = A~2^2 I = F^ = B^3^ = A^^3^ J = F^2 = B^3^2 = A^^3^2 reference: http://schacon.github.io/git/git-rev-parse#_specifying_revisions Wish this helps. regards, Stanley Huang

[ Level 1 ] Limit memory usage in Python program

We could limit memory usage in Python program. #!/usr/bin/env python3.5 import resource def show_memory_limit(): soft, hard = resource.getrlimit(resource.RLIMIT_DATA) print 'Soft limit changed to :', soft print 'Hard limit changed to :', hard def set_memory_limit(soft, hard): resource.setrlimit(resource.RLIMIT_DATA, (soft, hard)) #limit to one kilobyte if __name__ == '__main__': show_memory_limit() set_memory_limit(1024, 2048) show_memory_limit() Wish this helps. regards, Stanley Huang