Skip to content

Instantly share code, notes, and snippets.

@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active May 3, 2024 10:44
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@keeferrourke
keeferrourke / install-google-fonts.sh
Last active May 22, 2023 12:38
A bash script to install all Google Fonts, system wide, on debian based systems (ex. Ubuntu)
#!/bin/sh
# Written by: Keefer Rourke <https://krourke.org>
# Based on AUR package <https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-google-fonts-git>
# dependancies: fonts-cantarell, ttf-ubuntu-font-family, git
sudo apt-get install fonts-cantarell ttf-ubuntu-font-family git
srcdir="/tmp/google-fonts"
pkgdir="/usr/share/fonts/truetype/google-fonts"
giturl="git://github.com/google/fonts.git"
xlfd_tmpl = u"-%(maker)s-%(family)s-%(weight)s-%(slant)s-%(widthtype)s-%(style)s-%(pixels)s-%(height)s-%(horiz)s-%(vert)s-%(spacing)s-%(width)s-%(registry)s-%(encoding)s"
def make_xlfd(maker="unknown", family=None, weight="normal", slant="r",
widthtype="normal", style="*", pixels=8, height="*",
horiz="*", vert="*", spacing="m", width="*", registry="iso8859",
encoding=1):
"""
Usage Example::
tom@desktop ~> python xlfd_maker.py --family "Input Mono" --size 9
# -*- encoding: utf-8 -*-
#
# Copyright © 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
;; image at: http://take.ms/VaXll
(def g {:a {:white :a :black :b}
:b {:white :d :black :c}
:c {:white :g :black :d}
:d {:white :c :black :e}
:e {:white :f :black :f}
:f {:white :b :black :g}
:g {:white :e :black :a}})
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active February 22, 2024 03:40
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
@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
@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)))))
@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)])}