Skip to content

Instantly share code, notes, and snippets.

View 1d10t's full-sized avatar
❄️
winter in russian midland is longer than 1/2 of year

Serg 1d10t

❄️
winter in russian midland is longer than 1/2 of year
View GitHub Profile
<?php
/**
*
* @param string $url
* @param integer $i
* @param array $userdata compact('data_type', 'prefix', 'data'))
*/
protected function saveImageToYandexDisk(&$url, $i, $userdata = array()){
static $config = null;
static $yandex_disk_client = null;
@1d10t
1d10t / fb-comments.js
Created February 18, 2018 00:46
facebook comments to texts
// click 'see more'
[].map.call(document.querySelectorAll('a.fss'), function(a){ a.click(); });
// get texts
[].map.call(document.querySelectorAll('.UFICommentActorAndBody'), function(d){ return d.querySelector('.UFICommentActorName').innerText+' пишет: '+d.querySelector('.UFICommentBody').innerText; }).join("\r\n\r\n")
<?php
$f = fopen('ttv.all.iproxy.m3u', 'r');
$i = 0;
$name = $folder = null;
while(($s = fgets($f)) !== false){
@1d10t
1d10t / orientationChange.js
Created August 25, 2017 23:46 — forked from richtr/orientationChange.js
JavaScript shim of iOS's window.orientation + orientationchange events for other (typically mobile) browsers
/*
* OrientationChange Event Shim
* http://github.com/richtr
*
* Copyright (c) 2012, Rich Tibbett
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@1d10t
1d10t / contacts2.db-to-vcf.php
Created May 27, 2017 00:53
android contacts2.db to vcard file (vcf) converter
<?php
ini_set('mbstring.language', 'Russian');
function db(){
static $db = null;
if(!$db){
$db = new SQLite3(__DIR__.'/contacts2.db');
$db->busyTimeout(60*60*1000);
@1d10t
1d10t / list_cadastre_ids.js
Last active April 8, 2017 09:33
list cadastre ids in region
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
// url deobfuscation function '129' from audioplayer.js
(function(t, i) {
"use strict";
function e(t) {
if (~t.indexOf("audio_api_unavailable")) {
var i = t.split("?extra=")[1].split("#"),
e = o(i[1]);
if (i = o(i[0]), !e || !i) return t;
e = e.split(String.fromCharCode(9));
@1d10t
1d10t / m3u8-downloader.ahk
Last active March 21, 2017 03:18
This script downloading remote MP3 files from M3U playlist and saving it with cute file names
fileext_from_url(url, default_ext = "mp3")
{
url_wo_query := RegExReplace(url, "(\?.*)?(#.*)?$", "")
SplitPath, url_wo_query, , , , fn
return, % fn "." ext_from_url(url, default_ext)
}
ext_from_url(url, default = "mp3")
{
@1d10t
1d10t / vk_m3u.js
Last active March 23, 2018 11:17
vkontakte music m3u generating content script
/*
run in console at https://vk.com/audio
to download from wall, go to https://vk.com/wall[ID]?own=1&offset=[OFFSET]
wait for m3u file
use this autohotkey script https://gist.github.com/1d10t/6f8b151e50905449c63abc851dceb167
to download mp3 files
*/
(function(){
@1d10t
1d10t / html_audio_balance_stereo.js
Created March 9, 2017 02:57
htmlaudioelement (audio) random stereo balance example
HTMLAudioElement.prototype.balance = function(leftValue, rightValue){
if(!this.leftGain || !this.rightGain){
var audioCtx = new AudioContext();
if(audioCtx.destination.channelCount != 2){
console.log('Destination channel count is not two:', audioCtx.destination.channelCount);
return;
}
var audioSrc = audioCtx.createMediaElementSource(this);