Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import os
import sys
import json
import re
import requests
def sanitize(title):
cleaned = re.sub('[^a-zA-Z0-9]+', '_', title)
@karel1980
karel1980 / cam.py
Created November 6, 2021 19:49
Head stabilizer
import cv2
import mediapipe as mp
import numpy as np
import math
import sys
LEFT_EYE = 33
RIGHT_EYE = 263
def main():
import itertools
I_PATTERN = [5,0,7,2,1,4,3,6]
J_PATTERN = [6,3,0,5,2,7,4,1]
def swapi(items):
return swap_with_pattern(items, I_PATTERN)
def swapj(items):
return swap_with_pattern(items, J_PATTERN)
/*
* Copyright 2015 Netflix, 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
*
* Unless required by applicable law or agreed to in writing, software
@karel1980
karel1980 / gist:6594769
Last active December 23, 2015 06:29
create schema.json based on output from GET /repository/schema/fieldType and GET /repository/schema/recordType
import json
# Usage:
#
# curl -O http://lilyserver:12060/repository/schema/fieldType
# curl -O http://lilyserver:12060/repository/schema/recordType
# python schema_json.py > schema.json
# lily-import schema.json
#
@karel1980
karel1980 / dilbert_rss_update.rb
Last active December 19, 2015 01:19
Host your own dilbert feed (image only) 1. slap this gist in a crontab 2. host the feed.xml file It's probably not legal to do this, so don't. I just wanted to make a point.
require 'nokogiri'
require 'open-uri'
def get_image_url()
# Find the url for today's dilbert comic on the home page
doc = Nokogiri::HTML(open("http://www.dilbert.com/"))
doc.css('div.STR_Image img').attr('src')
end
def update_feed(image_url)
@karel1980
karel1980 / base.pp
Created June 5, 2012 10:46
All sorts of interesting packages to bootstrap a desktop machine.
class base {
$basepackages = [
"acidrip", "ack-grep", "apparix", "apt-utils", "audacity", "apt-cacher", "apache2", "atop",
"bzr", "bwm-ng",
"chromium-browser", "chromium-codecs-ffmpeg", "clusterssh", "compizconfig-settings-manager", "curl", "calibre", "cheese", "clojure",
"dconf-tools", "desktopcouch-ubuntuone", "devscripts", "dvdrip", "dvdbackup", "dsh", "dos2unix",
"ec2-ami-tools", "ec2-api-tools",
"ffmpeg", "freemind",
"gcompris", "gcompris-sound-nl", "gimp", "git-svn", "gitk", "gnuplot", "groovy", "grpn", "gtk-recordmydesktop", "gddrescue", "gconf-editor", "glade", "graphviz",
"htop",
karel@tomato:~/work/outerthought/whirr$ ruby build-tools/update-versions 12345
Updating to version 12345 ...
build-tools/update-versions:61:in `process_module': undefined method `inner_html=' for nil:NilClass (NoMethodError)
from build-tools/update-versions:54:in `edit_pom'
from build-tools/update-versions:60:in `process_module'
from build-tools/update-versions:73
from build-tools/update-versions:73:in `each'
from build-tools/update-versions:73
from build-tools/update-versions:54:in `edit_pom'
from build-tools/update-versions:67
# define 'classes': collections of useful role combinations
whirr.instance-class.web=role1+role2
whirr.instance-class.db=role3+role4
# define profiles. these could describe hardware, image, memory, ...
whirr.instance-descriptor.lightweight.hardwareId=x1.large
whirr.instance-descriptor.heavyweight.hardwareId=x4.large
# cluster:
whirr.instance-templates=3 web/heavyweight, 1 db/lightweight, 1 db/heavyweight