Skip to content

Instantly share code, notes, and snippets.

@yurukov
yurukov / README
Last active August 29, 2015 14:27
Permalink update support and optimization of jetpack share module for WP
I updated my permalink structure from .../Y/m/d/title to .../Y/title.
Naturaly the share button count was set to 0 due to the new URL. My
solution was to use the old URL structure for the share buttons only
for posts before the update. The downside of this is that old posts
will be shared with the old url structure. Thus when shared, there'll
be another 301. Upside - share count is kept.
Also, I wanted to optimize the scripts written to the footer by the
share module of jetpack. The registered js file includes all the
scripts for opening the share dialogs in a new window. These are the
@yurukov
yurukov / README
Last active November 19, 2021 10:12
Scraping a full Facebook group page from a browser
These are a few commands that could be used to scrape a full group page
from Facebook. One can use the Graph API, but there some users would be
hidden. The JS commands should be run in a browser and scroll through
the page opening up hidden content and comments. I used Chrome. Once
enough content is opened, you should save the page as any other and
analyse it's contents.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yurukov
yurukov / more.txt
Created April 14, 2015 13:36
Всички ЕКАТТЕ-та на населените места с територия по плажната ивица
24102
39493
83017
73780
35746
65543
07257
35064
05009
72693
@yurukov
yurukov / gist:9f728767ca9bb9945ee2
Last active August 29, 2015 14:17
Algo for RT tweets in @GivAlertEU
This is a an abstract description of the loopback algorythm that @govalerteu uses to RT tweets from a selection of accounts.
The database keeps a list of all the accounts that are monitored with the timestamp of the last RT and check (run of this algo), the number of all tweets that were RT and the sum of their RT and fav.
For each account on regular intervals:
1. List all the tweets since the last check
2. Exclude all that are newer than 2 hours
3. Exclude all the answers
4. Sort them in 3 categories - tweets in Bulgarian, tweets mentioning Bulgaria and others. Sort these categories by the number of RTs and then by the number of fav.
5. Get the one on the top and check if it has more fav+RT than 2/3 of the average of those RT-ed until now for this account, but not less than 3. If the account hasn't been retweeted for over 4 days and 2 hours, RT the top tweet if it has more than 3 RT+fav.
@yurukov
yurukov / neighbors.csv
Created March 25, 2015 17:13
Settlement neighbors in Bulgaria by ekatter codes
ekatte neighbors
00014 04399|04707|12499|22616|39726|56109|72268|77058|77222
00028 07260|15552|35198|43579|44241|77311
00031 00268|21470|38618|57858|63094|65906
00045 04337|15237|17436|23337|30898|32915|58966|65958|66682|69660|81582
00059 32603|55631|63687
00062 37085|63402|68240
00084 03719|10611|21419|30627|35208|61741|65125|66490|73393
00093 04306|15878|20393|20403|81027
00103 06536|17244|17542|20420|39431|40943|46509
@yurukov
yurukov / Bulgaria_forests.csv
Last active August 29, 2015 14:17
Extent, canopy closure, loss and gain in Bulgarian forests per settlements in Bulgaria 2000-2013
ekatte forests canopy_closure gain2000 loss2000 loss2000_s2011
00014 0.3091 0.216 0.0445 0.0041 0.00084
00028 0.7951 0.3148 0.0043 0.0273 0.00546
00031 0.0497 0.141 0.008 0.0022 0.00161
00045 0.5988 0.3039 0.0079 0.0083 0.00002
00059 0.5396 0.2832 0.0083 0.008 0.00252
00062 0.5591 0.2441 0.0083 0.0003 0
00084 0.4435 0.2803 0.0015 0.0018 0.00007
00093 0.7846 0.316 0.0145 0.0026 0.0004
00103 0.3307 0.2802 0.0365 0.2392 0.04472
@yurukov
yurukov / cut_tif_bulgaria.php
Created March 20, 2015 13:41
Cut a tif file with data to the borders of Bulgaria
<?php
$file = $argv[1];
echo date('H:i:s')."\n";
$image = new Imagick($file);
echo date('H:i:s')."\n";
$image->cropImage(25000,11900,9440,23160);
$image->writeImage('cut_'.$file);
echo date('H:i:s')."\n";
@yurukov
yurukov / find_geojson_loops.js
Last active August 29, 2015 14:17
Detecting loops in polygons and multipolygons in geojson.
var fs = require("fs");
var geojson = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
for (var n=0;n<geojson.features.length;n++) {
var feature = geojson.features[n];
var geom = feature.geometry.coordinates;
if (feature.geometry.type=='Polygon')
geom=[geom];
var list=[];
for (var i=0;i<geom.length;i++)
for (var j=0;j<geom[i].length;j++)
01 BLG
02 BGS
03 VAR
04 VTR
05 VID
06 VRC
07 GAB
08 DOB
09 KRZ
10 KNL