Skip to content

Instantly share code, notes, and snippets.

@omangin
omangin / nmf_kl.py
Last active August 9, 2019 06:30
Non-negative matrix factorization for I divergence
""" Non-negative matrix factorization for I divergence
This code was implements Lee and Seung's multiplicative updates algorithm
for NMF with I divergence cost.
Lee D. D., Seung H. S., Learning the parts of objects by non-negative
matrix factorization. Nature, 1999
"""
# Author: Olivier Mangin <olivier.mangin@inria.fr>
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

@owainlewis
owainlewis / Example.hs
Last active June 1, 2020 20:30
Haskell HTTP GET request example
module Example () where
import Network.HTTP
-- Non HTTPS
-- 1. Perform a basic HTTP get request and return the body
get :: String -> IO String
get url = simpleHTTP (getRequest url) >>= getResponseBody
@Glutexo
Glutexo / gist:5669c06ef54e60684c4433e0a9e29534
Created January 29, 2021 17:22
APA - AstraZeneca.pdf[1].txt
Obsah:
* 2020.08.27 APA - FINAL AZ signature only - Legal Redactions
* 1. Definitions.
* 1.1. “Accounting Standards” means International Financial Reporting Standards (IFRS).
* 1.2. “Additional Doses” has the meaning given in Section 5.3.
@zajdee
zajdee / Digital-Green-Certificate-Dump.py
Last active November 5, 2021 19:15
A simple tool to dump the European Union's COVID passports (Digital Green Certificates)
#!/usr/bin/env python3
# install dependencies:
# pip install base45 cbor2 (cwt - not used here)
import sys
import zlib
from base45 import b45decode
from cbor2 import loads
@j4mie
j4mie / normalise.py
Created August 30, 2010 12:44
Normalise (normalize) unicode data in Python to remove umlauts, accents etc.
# -*- coding: utf-8 -*-
import unicodedata
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """
data = u'naïve café'
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore')
print normal
@GaelVaroquaux
GaelVaroquaux / mutual_info.py
Last active June 18, 2023 12:25
Estimating entropy and mutual information with scikit-learn: visit https://github.com/mutualinfo/mutual_info
'''
Non-parametric computation of entropy and mutual-information
Adapted by G Varoquaux for code created by R Brette, itself
from several papers (see in the code).
This code is maintained at https://github.com/mutualinfo/mutual_info
Please download the latest code there, to have improvements and
bug fixes.
@sj26
sj26 / phpserialize.py
Created February 2, 2010 09:53
Python port of PHP serialize() and unserialize()
#!/usr/bin/python -u
"""
Python port of PHP serialize() and unserialize()
by Samuel Cochran <sj26@sj26.com>
I couldn't find a nice, fairly efficient implementation of serialize/unserialize for Python... so I wrote one. I didn't use str().partition because I wanted Python <2.5 compatibility.
TODO: Performance review. There's an awful lot of string copying. >.>
@nullbind
nullbind / SQL Server Connection Strings CheatSheet
Last active December 20, 2023 01:11
SQL Server Connection Strings CheatSheet
Below is a cheatsheet for creating SQL Server client connection strings and finding them in common configuration files.
------------------------------------------------------------------
CREATING CONNECTION STRINGS
------------------------------------------------------------------
----------------------
Authentication Options
----------------------
@phpdude
phpdude / nginx.conf
Last active February 28, 2024 04:36
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;