Skip to content

Instantly share code, notes, and snippets.

View un1t's full-sized avatar

Ilya Shalyapin un1t

View GitHub Profile
/*
Youtube playback rate hotkeys:
Ctrl + UP
Ctrl + DONW
*/
function createPlaybackRateDisplay() {
var elem = document.createElement('span');
elem.style = 'position: fixed; left: 0; top: 0; z-index: 10000; background: #000; color: #fff; font-size: 32px;'
elem.setAttribute('id', 'paylbackRateDisplay')
@un1t
un1t / raw_prefetch_related.py
Created November 11, 2016 11:44
Django raw with prefetch_related
@un1t
un1t / django-script.py
Created February 21, 2015 21:48
How to run scripts outside django
# coding: utf-8
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
django.setup()
# write your code here
@un1t
un1t / elastic-bulk.go
Last active October 18, 2021 01:49
golang elasticsearch bulk insert
package main
import (
"fmt"
"gopkg.in/olivere/elastic.v2"
"strconv"
)
type Tweet struct {
User string `json:"user"`
@un1t
un1t / parse-xml.go
Last active January 3, 2022 09:36
Golang XML stream parser
package main
// https://github.com/dps/go-xml-parse/blob/master/go-xml-parse.go
import (
"fmt"
"os"
"encoding/xml"
)