Skip to content

Instantly share code, notes, and snippets.

View cynthia's full-sized avatar
💩
<- mainly producing this

Sangwhan "fish" Moon cynthia

💩
<- mainly producing this
View GitHub Profile
# mish_original(), (c) 2019 Diganta Misra
# https://github.com/digantamisra98/Mish/blob/master/LICENSE
#
# Other functions MIT licensed, (c) 2019 Sangwhan Moon
# In [53]: %timeit mish_original(x)
# 30.2 µs ± 184 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
# In [54]: %timeit mish1(x)
# 194 µs ± 1.68 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
@cynthia
cynthia / fastmcd_zca.py
Last active November 15, 2017 03:17
A experimental Mahalanobis whitening (ZCA) implementation using covariance approximation with FastMCD. I don't know if this is mathematically correct or whether if this works or not. Use with caution.
# -*- coding: utf-8 -*-
import numpy
from sklearn.covariance import MinCovDet
class FastMCDZCA():
"""
An implementation of Mahalanobis whitening (ZCA) using FastMCD. This
implementation has a couple questionable pseudoscience bits that I haven't
# Simple (?) example of descriptor use in Python.
class FullName():
def __get__(self, i, o):
return '%s %s' % (i.first_name, i.last_name)
class LastName():
def __get__(self, i, o):
if i.married and i.gender == Person.female and i.spouse is not None:
@cynthia
cynthia / goimagehash_cli.go
Created August 4, 2017 10:02
Quick and dirty hack CLI for goimagehash library. https://github.com/corona10/goimagehash
package main
import (
"github.com/corona10/goimagehash"
"fmt"
"image"
_ "image/jpeg"
_ "image/png"
"os"
@cynthia
cynthia / gfree.py
Created August 3, 2017 06:27
Simple script for checking free memory across all Nvidia GPUs. Linux+Nvidia only. Requires NVML.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from pynvml import *
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
@cynthia
cynthia / find_chromiums.py
Created July 31, 2017 06:52
Quick and dirty script to find all CEF and Electron installations in macOS. (Not the prettiest code, to be addressed later)
#!/usr/local/bin/python3
import os
MRD = 10
def recursive_suffix_find(p, s='.app', cs=False, do=True, d=0):
a = []
try:
l = os.listdir(p)
@cynthia
cynthia / upo.php
Created July 8, 2017 18:37
Weird science experiment that makes every non-existent class in the current PHP execution context ORM backed with Redbean.
<?php
/**
* UPO : Unidentified PHP Object (미확인 PHP 객체)
*
* Here be dragons. This abuses every odd PHP language feature known to man.
* which means it is highly experimental, and should *never* be used in a
* production environment. Failing to do so may expose your application to
* numerous security exploits, and the author takes no liability for damages
* caused by ignoring this warning.
@cynthia
cynthia / makefile.inc
Created May 16, 2017 06:35
FAISS build for OS X + Intel Compiler
# -*- makefile -*-
# Tested on macOS Sierra (10.12.2) with llvm installed using Homebrew (https://brew.sh)
# brew install llvm
CC=icpc
CFLAGS=-fPIC -m64 -Wall -g -O3 -msse4 -mpopcnt -fopenmp -Wno-sign-compare -Dnullptr=NULL -Doverride= -I/Users/cynthia/anaconda3/include/python3.6m/
LDFLAGS=-g -fPIC -fopenmp
# common mac flags
@cynthia
cynthia / profile_bikeshed.txt
Created September 21, 2016 13:59
Bikeshed cProfile results running on html spec
101145335 function calls (99365215 primitive calls) in 317.453 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 <string>:1(ArgInfo)
1 0.000 0.000 0.000 0.000 <string>:1(ArgSpec)
1 0.000 0.000 0.000 0.000 <string>:1(Arguments)
1 0.000 0.000 0.000 0.000 <string>:1(Attribute)
금강반야바라밀경 전문
개경게
무상심심미묘법 백천만급난조우 아금문견득수지 원해여래진실의
개법장진언
옴 아라남 아라다 옴 아라남 아라다 옴 아라남 아라다 (세번)
금 강 반 야 바 라 밀 경