Skip to content

Instantly share code, notes, and snippets.

@Smerity
Smerity / part-r-00000
Created April 6, 2014 23:38
Output from the Common Crawl HTML tag frequency count run over a single compressed 859MB WARC file
0 48
0000 6
0l 1
0xdc00 13
1 69
10 11
100 3
1001 1
100154 1
1004 1
@johnmiedema
johnmiedema / TestCustomOpenNlpModel
Last active March 11, 2019 22:23
Test a custom OpenNLP model
//Test a custom OpenNLP model for NER of book titles
//See https://gist.github.com/johnmiedema/4020deea875ce306971e
package demoModelTrainer;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import opennlp.tools.namefind.NameFinderME;
@pcarrier
pcarrier / _instructions
Last active December 26, 2021 17:23
Chrome Remote Desktop
The remote desktop session has to be headless :(
- Install the deb (can convert with alien & co)
- Patch with modern_distro.diff (cherry-pick what your system needs)
- To support automatic desktop resizing:
- Works with any window manager
- Build Xvfb with xvfb-randr.diff
- Expose as /usr/bin/Xvfb-randr
- If replacing system-wide binary by repackaging, simply
# ln -sf Xvfb /usr/bin/Xvfb-randr
@karussell
karussell / GridTraversal.java
Created July 10, 2014 22:38
Fast Voxel Grid Traversal Algorithm
public static void calcPoints( double y1, double x1, double y2, double x2,
PointEmitter emitter )
{
int x = (int) x1, y = (int) y1;
int endX = (int) x2, endY = (int) y2;
// deltaX and Y is how far we have to move in ray direction until we find a new cell in x or y direction
// y = u + t * v, where u=(x1,x2) and v=(stepX,stepY) is the direction vector
final double gridCellWidth = 1, gridCellHeight = 1;
@willpatera
willpatera / Google-Sheet-Form-Post.md
Last active November 9, 2024 15:22
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.

Run example

You should be able to just open index.html in your browser and test locally.

@finalfantasia
finalfantasia / fixing_text_anti_aliasing_in_fedora.md
Last active April 20, 2025 19:39
Fixing Text Anti-aliasing in Fedora
  1. Add the RPMFusion repositories (both free and non-free) to the YUM repository directory (/etc/yum.repos.d/):
sudo dnf localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  1. Install the patched version of FreeType with subpixel rendering enabled:
sudo dnf install -y freetype-freeworld
@mbroecheler
mbroecheler / gist:1450d1f7fa5d3dc75aab
Last active August 29, 2015 14:07
Making sure cache is faster than embedded BDB
gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
==>titangraph[berkeleyje:/tmp/test]
gremlin> mgmt = g.getManagementSystem();
==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@27c04377
gremlin> id = mgmt.makePropertyKey("uid").dataType(Long.class).make()
==>uid
gremlin> mgmt.buildIndex('byUID',Vertex.class).addKey(id).buildCompositeIndex()
==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@14f3c6fc
gremlin> mgmt.commit()
gremlin> for (int i=0;i<200;i++) { v = g.addVertex([uid:(int)Math.floor(i/2)])}
@lugoues
lugoues / stern-brocot-sequence.clj
Last active July 13, 2018 08:45
Clojure: Stern-Brocot Sequence
;; See: http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree
(def stern-brocot-sequence
(map (fn [nums]
(/ (first nums) (second nums)))
(iterate
(fn [nums]
(let [a (first nums)
b (second nums)
r (rest (rest nums))]
(vec (flatten (conj [] b r (+ a b) b)))))
@matpalm
matpalm / gpu_stat.py
Last active October 10, 2023 10:31
json formatting of nvidia-settings
#!/usr/bin/env python
# gpu_stat.py [DELAY [COUNT]]
# dump some gpu stats as a line of json
# {"util":{"PCIe":"0", "memory":"11", "video":"0", "graphics":"13"}, "used_mem":"161"}
import json, socket, subprocess, sys, time
try:
delay = int(sys.argv[1])
except:
delay = 1
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active April 24, 2025 05:25
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation