This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Test to figure out combinations of at least two elements of provided array. | |
* | |
* by Sergei Sokolov, hello@sergeisokolov.com, 2015 April 27, St. Petersburg. | |
* Fiddle: http://jsfiddle.net/sergiks/2ojgqxk1/ | |
*/ | |
function comb(a) { | |
var l, cursor, mask, tail, out=[]; | |
l = a.length; | |
if( l<2 || l>32) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="keywords" content=""> | |
<meta name="robots" content=""> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var diff | |
,I = new Date('2016-01-01T00:00:02') | |
,O = new Date('2017-01-01T00:00:01') | |
; | |
/** | |
* Calendar difference between two dates | |
* | |
* It takes into account the number of days in a month, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Backup database and files of a Wordpress blog running in a Docker container | |
# | |
# by Sergei Sokolov hello@sergeisokolov.com | |
# Moscow, 2016 September 08 | |
# | |
DC_MYSQL=dockerwp_mysql_1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(t){var e,n,a,h=$("table"),r={},o=new Date,l="";if(!("my.appscentrum.com"!=window.location.hostname||h.length<4)){for(o.setDate(1),a=0;t>a;a++)e=("0"+(parseInt(o.getMonth())+1)).substr(-2),n=""+o.getFullYear(),r[""+e+"."+n]=0,o.setMonth(o.getMonth()-1);h=h[3],$("tr",h).each(function(t,e){var n,a,h=$("td:nth-child(5)",this).text().split(/[\ \.]/);h.length>=2&&(a=""+h[1]+"."+h[2],r.hasOwnProperty(a)&&(n=$("td:nth-child(3)",this).text(),(n=n.replace(/[^0-9\.]+/g,"")).length&&(r[a]+=parseFloat(n))))});for(key in r)l+=""+Math.round(100*r[key])/100+" руб. за "+key+"\r\n";alert(l)}})(5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bookmarklet for my.appscentrum.com | |
* to display agregated payouts by month | |
* for the last 3 months. | |
* | |
* Minify with command: | |
* | |
* uglifyjs -m -c negate-iife=false apps-centrum-sum.js | |
* | |
* by Sergei Sokolov hello@sergeisokolov.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Перевод численных в числа и чисел в текст на Русском языке. | |
* | |
* Сергей Соколов hello@sergeisokolov.com Москва 2017. | |
*/ | |
class NumText { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Rail Fence (zigzag) cipher JavaScript implementation. | |
* https://en.wikipedia.org/wiki/Rail_fence_cipher | |
*/ | |
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define([], factory); | |
} else if (typeof module === 'object' && module.exports) { | |
module.exports = factory(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Отправка ЛС во ВКонтакте скриптом из консоли браузера. | |
* Эксперимент для валидации идеи с Electron-приложением. | |
* Работает 2017-06-09 в Firefox 53.0.3 (64-bit) / Mac OS X 10.11.6 | |
* | |
* Выполнять на странице диалога с нужным пользователем | |
* https://vk.com/im?sel=755074 цифры в конце это id пользователя ВК. | |
* | |
* by Sergei Sokolov, hello@sergeisokolov.com, 2017-06-09, Moscow. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This will dump a list of every directory on the filesystem prefixed with | |
# the number of files (and subdirectories) in that directory. | |
# Thus the directory with the largest number of files will be at the bottom. | |
find / -xdev -printf '%h\n' | sort | uniq -c | sort -k 1 -n | |
# Source: https://unix.stackexchange.com/questions/117093/find-where-inodes-are-being-used |
OlderNewer