Skip to content

Instantly share code, notes, and snippets.

@kirel
kirel / draft.markdown
Created July 19, 2009 12:01
Detexify explained

Preface

This is an overview over the inner workings of Detexify. Extended knowlege in pattern recognition or machine learning is not necessary as I will explain some basics but understanding of linear algebra will definitely help. I have to note that I am not an expert, either. I more or less stumbled into this because of this project. Experts in this field may safely skip the first section.

What's the problem?

@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@brunobraga
brunobraga / gmail-count
Last active June 15, 2023 11:49
A simple Gmail unread count script for i3status or conky bars, taking care of its own time frequency (avoid overhead in simplistic approaches such as i3status). See --help for documentation and usage details.
#!/usr/bin/python
###############################################################################
#
# file: gmail-count
#
# Purpose: generates a string value representing the Gmail unread email count.
#
# Usage: pipe the i3status with this script (see i3status manpage)
# or use conky.
#
@nzjrs
nzjrs / rospy_logging.py
Created January 30, 2014 16:06
Reconnect python logging calls with the ROS logging system
class ConnectPythonLoggingToROS(logging.Handler):
MAP = {
logging.DEBUG:rospy.logdebug,
logging.INFO:rospy.loginfo,
logging.WARNING:rospy.logwarn,
logging.ERROR:rospy.logerr,
logging.CRITICAL:rospy.logfatal
}
@pcholakov
pcholakov / post-receive-jenkins
Created February 2, 2014 16:13
Gitolite post-receive hook to trigger builds of Jenkins / Git jobs
#!/bin/bash
# Gitolite [https://github.com/sitaramc/gitolite]
# Jenkins Git Plugin [https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin]
# GL_REPO will contain the short relative path of the repository being pushed to, e.g. "projects/component-1", so transform it into the Git URL format that your Jenkins build jobs follow:
REPOSITORY_URL=git@gitolite.example.com:$GL_REPO
# Jenkins Git plugin notification URL -- update host as appropriate:
TRIGGER_URL=http://jenkins.example.com:8080/git/notifyCommit?url=$REPOSITORY_URL
@joostrijneveld
joostrijneveld / gpg2qrcodes.sh
Created May 20, 2014 19:43
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
@maxtruxa
maxtruxa / Antonyms.md
Last active June 18, 2024 18:39
A list of common terms used in programming and their respective antonyms.

Antonym List

Note: The table headings (positive/negative) are not necessarily meaningful.

Positive Negative
acquire release
add remove (e.g. an item), subtract (arithmetic)
advance retreat
allocate deallocate (correct), free (common)
allow deny
@karpathy
karpathy / min-char-rnn.py
Last active June 16, 2024 04:05
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@mjj2000
mjj2000 / get-current-git-tag.sh
Last active June 4, 2024 14:55
[GIT] Get tag of current branch(that is HEAD) or fallback to short commit hash(7 digits) by single shell command
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD
@bxshi
bxshi / Hits_at_K_TensorFlow.py
Created January 12, 2017 21:34
Implement Hits@K evaluation metric for Knowledge Graph Completion tasks.
import tensorflow as tf
with tf.Session() as sess:
"""
idx (h,r) top_3
[ [
[0,1], [0,8,3],
[1,3], [7,2,1],
[2,4], [4,3,9],
] ]