Skip to content

Instantly share code, notes, and snippets.

@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00: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!

@tpryan
tpryan / ribbon.html
Last active April 11, 2024 00:21
Github Ribbon in CSS.
<!--
Copyright (c) 2012 Terrence Ryan
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.
@vanstee
vanstee / Makefile
Created May 28, 2015 17:39
Building frontend stuff with make
# Base dirs
SRC_DIR = src
TMP_DIR = tmp
DEV_DIR = dev
SRC_PUBLIC_DIR := $(SRC_DIR)/public
SRC_STYLES_DIR := $(SRC_DIR)/styles
SRC_SCRIPTS_DIR := $(SRC_DIR)/scripts
TMP_SCRIPTS_DIR := $(TMP_DIR)/scripts
DEV_PUBLIC_DIR := $(DEV_DIR)/public
DEV_STYLES_DIR := $(DEV_DIR)/styles
@alfredodeza
alfredodeza / whisper.vim
Created May 11, 2015 14:28
map the undo to whisper balls
" I don't remember exactly how to make it not spit out the actual command you are running. Meh.
nnoremap u :call system("say -v whisper 'balls'")<CR>
@ftfarias
ftfarias / README.md
Created January 24, 2017 23:10 — forked from datagrok/README.md
Circular imports in Python 2 and Python 3: when are they fatal? When do they work?

When are Python circular imports fatal?

In your Python package, you have:

  • an __init__.py that designates this as a Python package
  • a module_a.py, containing a function action_a() that references an attribute (like a function or variable) in module_b.py, and
  • a module_b.py, containing a function action_b() that references an attribute (like a function or variable) in module_a.py.

This situation can introduce a circular import error: module_a attempts to import module_b, but can't, because module_b needs to import module_a, which is in the process of being interpreted.

But, sometimes Python is magic, and code that looks like it should cause this circular import error works just fine!

@Aissen
Aissen / gist:2925633
Created June 13, 2012 18:20
Linux users: watch out for last-gen Intel Atom

Linux users: watch out for last-gen Intel Atom

Oops. They did it again.

It hit the market during the last few weeks. Last generation of Intel Atoms: CedarView (D2300, D2500, D2550, D2600, D2700) and Cedar Trail (N2600, N2700, N2800) SoCs integrate a PowerVR GPU from Imagination instead of the usual Intel GPU. If you remember the Poulsbo fiasco, it's the same. More or less.

An unsupported graphic card on Linux distributions, and which can't properly support a basic desktop environnment like Unity or Gnome 3.

To prevent this issue, Intel woke up MeeGo from the dead in last february [to add support for CedarView]

@queertypes
queertypes / .psqlrc.sql
Last active February 12, 2017 22:47
Allele's psqlrc
-- make psql really quiet while the next several commands are processed
\set QUIET 1
-- a colorful prompt that displays, in order:
-- * hostname (green)
-- * port number (yellow)
-- * user (blue)
-- * database (purple)
-- in the format: host:port user@db#
\set PROMPT1 '%[%033[1;32m%]%M:%[%033[1;33m%]%> %[%033[1;34m%]%n@%[%033[1;35m%]%/%R%[%033[0m%]%# '
@nrb
nrb / y260.md
Created April 28, 2016 20:26
Unorganized notes about getting ArchLinux running on a Lenovo Thinkpad Y260

Installing

Disable SecureBoot for the time being.

For booting my Archlinux kernel (4.3 series on the USB drive I made), I needed the following options:

nomodeset intel_pstates=no_hwp

You can edit the parameters by hitting the e key on the ArchISO boot option