Skip to content

Instantly share code, notes, and snippets.

View ulidtko's full-sized avatar
🤔
What it feels like, to live in a collapsing civilization?

Maxim Ivanov ulidtko

🤔
What it feels like, to live in a collapsing civilization?
View GitHub Profile
// ==UserScript==
// @name Enable right click on 500px.com
// @namespace jQueryForChromeExample
// @include *
// @author Max Ulidtko
// @description Disables the blocker of right clicking on 500px images
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
@ulidtko
ulidtko / vk-audio.py
Created November 21, 2012 08:49
VK API Python client
#!/usr/bin/env python
from vk import VkAPI
my_id = "8281539"
app_id = "1846406"
secret = "xxxxxxxxxxx"
if __name__=='__main__':
import json
@ulidtko
ulidtko / mahjong-tileset.html
Last active December 21, 2015 03:58
A quick page with the full set of 136 click-dissolvable Mahjong tiles. Be sure to use Unicode (⩾5.1) –compliant fonts.
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Mahjong tile set</title>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<style>
body {

I use a cordless mouse, and it's powered by a pair of alkaline LR6 batteries (the ubiquitous 1.5 V ones). It's been frustrating to have to replace them every few months once they drain, often in a middle of an activity (such as gaming online). Even though I try to recycle the used batteries, having to go out for fresh ones is an inconvenience.

So, instead of obtaining a stock of alkalines, I [bought][dx 14500] a few rechargable LiPo batteries in the 14500 form factor, and a lithium-polymer charger. The nice thing about this form-factor is that it matches AA: mechanically, you can insert 14500 in whatever AA holder your device has got. The bad thing is that the voltage is different. Single LiPo cell has 3.1–4.2 range (with 3.7 V nominal), while alkalines produce 1.0–1.5. A pair of alkalines, however, is usually required for the common 3.3 V digital logic; so, with trivial modifications to the holder, I was able to go like this:

14500 photo

@ulidtko
ulidtko / libusbx debug log
Last active August 29, 2015 14:03
Heimdall SGS5 USB capture
Heimdall v1.4.1
Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna
http://www.glassechidna.com.au/
This software is provided free of charge. Copying and redistribution is
encouraged.
If you appreciate this software and you would like to support future
development please consider donating:
@ulidtko
ulidtko / git-debtag
Created August 13, 2014 17:54
External Git command for autotagging Debian package repos via debian/changelog blaming
#!/bin/sh
pkgname=$(dpkg-parsechangelog | sed -n 's/^Source: //p')
git blame -ltf debian/changelog \
| awk '/^[0-9a-f]+ .+ (\([^)]*\)) '$pkgname'/{gsub("[()]", "", $8); print $8, $1}' \
| head -n 50 | xargs -l1 git tag -f
@ulidtko
ulidtko / ana2.hs
Last active July 1, 2020 09:05
anamorphism excercise
#!/usr/bin/env runghc
{-# LANGUAGE DeriveFunctor, DeriveFoldable #-}
{-# LANGUAGE ViewPatterns, LambdaCase #-}
{-# LANGUAGE Rank2Types #-}
module Main where
import Data.List (sort, elemIndices)
import qualified Data.Tree
@ulidtko
ulidtko / transdeps.hs
Last active October 28, 2019 17:33
Yum dependency walker script
{-# LANGUAGE ViewPatterns, LambdaCase, FlexibleContexts #-}
module Main where
import Control.Applicative
import System.Environment
import System.Exit
import System.IO
import System.Process
import Data.List (nub, sort)
@ulidtko
ulidtko / traverse.hs
Created April 26, 2016 12:24
Imperative tree traversal sample
{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Control.Applicative
import Data.Foldable
import Data.Traversable
import Data.IORef
data BinTree a = Leaf a | Node (BinTree a) (BinTree a)
deriving (Functor, Foldable, Traversable, Show)