Skip to content

Instantly share code, notes, and snippets.

View azalea's full-sized avatar
😂
Enjoy life

Z azalea

😂
Enjoy life
View GitHub Profile
@azalea
azalea / linux_one_liners.md
Created March 19, 2014 04:23
Linux one-liners

Find the length of each line in the file

while read line; do echo -n "$line" | wc -c; done< f1
@azalea
azalea / getattr.py
Last active August 29, 2015 14:03
Use getattr() to access any attribute of any class instance
# Say I have such classes A, B, C, ..., Y, and Z that do different things,
# and classes AComment, BComment, CComment, ..., YComment and ZComment
# that record comments on instances of class A, B, ..., Y and Z respectively.
# All XComment classes share the same attributes except one property
# that is is dependent on the class the comment is for.
# e.g. AComment has a property 'a' and BComment has a property 'b'.
class A():
def __init__(self):
print 'init an instance of class A'
@azalea
azalea / init.el
Created December 3, 2015 20:09
emacs init.el for Windows
;; Requisites: Emacs >= 24
;; INSTALL PACKAGES
;; --------------------------------------
(prefer-coding-system 'utf-8)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
!macro ProcessEnvPrependPath UN
;; ref: http://stackoverflow.com/a/32384667/1292238
!ifndef ERROR_ENVVAR_NOT_FOUND
!define ERROR_ENVVAR_NOT_FOUND 203
!endif
!if "${NSIS_PTR_SIZE}" <= 4
!include LogicLib.nsh
Function ${UN}ProcessEnvPrependPath ; IN:Path OUT:N/A
System::Store S
Pop $1
@azalea
azalea / ProcessEnvPrependPath.nsh
Last active December 8, 2016 14:21
NSIS macro to prepend to system path during install / uninstall process
!macro ProcessEnvPrependPath UN
;; ref: http://stackoverflow.com/a/32384667/1292238
!ifndef ERROR_ENVVAR_NOT_FOUND
!define ERROR_ENVVAR_NOT_FOUND 203
!endif
!if "${NSIS_PTR_SIZE}" <= 4
!include LogicLib.nsh
Function ${UN}ProcessEnvPrependPath ; IN:Path OUT:N/A
System::Store S
Pop $1
@azalea
azalea / build_openssl_dylib.sh
Created January 6, 2021 23:06 — forked from tmiz/build_openssl_dylib.sh
Build latest OpenSSL Universal Binary on OSX
#!/bin/bash
OPENSSL_VERSION="1.0.1g"
curl -O http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_x86_64
cd openssl_i386