Skip to content

Instantly share code, notes, and snippets.

View skakri's full-sized avatar
🖱️
Click to enable Adobe Flash Player

Kristaps Karlsons skakri

🖱️
Click to enable Adobe Flash Player
View GitHub Profile
@skakri
skakri / gist:9090925
Last active August 29, 2015 13:56 — forked from jorilallo/gist:1701845
haystack + tastypie symbiosis
from django.conf.urls.defaults import *
from tastypie.paginator import Paginator
from tastypie.exceptions import BadRequest
from tastypie.resources import ModelResource
from tastypie.utils import trailing_slash
from haystack.query import SearchQuerySet, EmptySearchQuerySet
from clips.models import Clip
/**
* Based off of the Lucene prolog parser in the wordnet contrib package within the
* main Lucene project. It has been modified to remove the Lucene bits and generate
* a synonyms.txt file suitable for consumption by Solr. The idea was mentioned in
* a sidebar of the book Solr 1.4 Enterprise Search Server by Eric Pugh.
*
* @see <a href="http://lucene.apache.org/java/2_3_2/lucene-sandbox/index.html#WordNet/Synonyms">Lucene Sandbox WordNet page</a>
* @see <a href="http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene/contrib/wordnet/">SVN Repository of the WordNet contrib</a>
* @see <a href="https://www.packtpub.com/solr-1-4-enterprise-search-server/book">Solr 1.4 Enterprise Search Server Book</a>
*/
@skakri
skakri / rails_tz.py
Created August 26, 2014 15:35 — forked from amitu/rails_tz.py
{
"Abu Dhabi": "Asia/Muscat",
"Adelaide": "Australia/Adelaide",
"Alaska": "America/Juneau",
"Almaty": "Asia/Almaty",
"American Samoa": "Pacific/Pago_Pago",
"Amsterdam": "Europe/Amsterdam",
"Arizona": "America/Phoenix",
"Astana": "Asia/Dhaka",
"Athens": "Europe/Athens",
@skakri
skakri / vunits.js
Last active August 29, 2015 14:25 — forked from LeaVerou/vunits.js
/**
* Polyfill for the vw, vh, vm units
* Requires StyleFix from -prefix-free http://leaverou.github.com/prefixfree/
* @author Lea Verou
*/
(function() {
if(!window.StyleFix) {
return;
@skakri
skakri / send_file_partial.py
Last active May 18, 2017 19:16 — forked from lizhiwei/send_file_partial.py
HTTP 206 (Partial Content) For Flask
import mimetypes
import os
import re
from flask import request, send_file, Response
@app.after_request
def after_request(response):
response.headers.add('Accept-Ranges', 'bytes')
return response
@skakri
skakri / 00readme.md
Created June 5, 2016 19:48 — forked from indrora/00readme.md
DeadUpdate: Kickin' it bigtime.

... my first disclosure. Man, it feels weird doing this.

From the vendor that brought you a
                        vulnerable cloud storage platform comes
                        
           ___              ____  __        __     __ 
          / _ \___ ___ ____/ / / / /__  ___/ /__ _/ /____ 
         / // / -_) _ `/ _  / /_/ / _ \/ _  / _ `/ __/ -_)

//_/_,/_,/_/ ./_,/_,/_/_/

@skakri
skakri / pca9685.lua.lua
Created August 29, 2016 19:33 — forked from anonymous/pca9685.lua.lua
pca9685.lua
local modname = ...
local M = {}
_G[modname] = M
local id = nil
local addr = nil
-- some flags from mode register, low byte is MODE1 and high is MODE2
M.INVERT = 0x1000
@skakri
skakri / spawn_once.lua
Created August 31, 2016 16:47 — forked from Flowkap/spawn_once.lua
This is a small gist for autostarting applications with Awesome Window Manager (http://awesome.naquadah.org/) without the need to use a third party plugin like shifty. It's maybe not nice but works!
-- {{{
--
-- Autostarting for Awesome <3.4!
-- Add this section to the end of your rc.lua
-- configuration file within ~/.config/awesome/rc.lua
--
-- If you're using Awesome 3.5 change:
-- add_signal -> connect_signal
-- remove_signal --> disconnect_signal
--
@skakri
skakri / i2c_stm.c
Created January 15, 2019 20:25 — forked from qdk0901/i2c_stm.c
i2c slave with PMS150C
#define I2C_SLAVE_ADDRESS (0xA0 >> 1)
#define BUF_SIZE 16
enum {
IDLE,
START,
STOP,
ADDR,
OP,
READDATA,
@skakri
skakri / crlf.screenrc
Created June 27, 2019 12:02 — forked from cabo/crlf.screenrc
Make GNU screen convert return key (CR) into CR-LF
# put this in your ~/.screenrc to make
# ^A D (uppercase) switch on, and
# ^A U (uppercase) switch off, converting
# CR (return keys) input into CRLF
bind D bindkey "\015" stuff "\015\012"
bind U bindkey "\015" stuff "\015"