Skip to content

Instantly share code, notes, and snippets.

View sanmai's full-sized avatar

Alexey Kopytko sanmai

View GitHub Profile
@sanmai
sanmai / flickr-to-html.php
Last active October 4, 2015 05:27
My Flickr to HTML convertor
<?php
define('API_KEY', 'set your Flickr API key here');
define('MY_USER_ID', '42620619@N05');
set_time_limit(600);
class flickrCall {
const URL_ENDPOINT = 'http://api.flickr.com/services/rest/?';
protected $data = array();
protected static $ch;
@sanmai
sanmai / YandexNotification.php
Created August 8, 2012 08:31
PHP class to send Yandex.Money HTTP notifications
<?php
/**
* PHP class to send Yandex.Money HTTP notifications
* @author sanmai
* @license MIT
*
* Usage:
*
* $notification = new YandexNotification();
* // Set notification properties as you need
@sanmai
sanmai / lottery.html
Last active December 10, 2015 09:59
This program hashes an array of strings made from IV2 plus each participant name with SHA1, where IV2 is formed from SHA1 hash of IV plus sorted list of participants thus making the draw dependent not only on the original IV, but also on the list of participant. Then it sorts a resulting list of participants by each participant's hash and shows …
<!DOCTYPE html><html><head><meta charset="utf-8" />
<title>Draw a lottery in JavaScript</title>
<style type="text/css">
label, button {
display: block;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha1.js"></script>
<script type="text/javascript">
// ==UserScript==
// @name Getty Images Flickr Helper
// @namespace http://userscripts.org/users/163777
// @include https://contribute.gettyimages.com/producer/images/flickr/*
// @require http://code.jquery.com/jquery.min.js
// @version 1.01
// @updateURL https://gist.github.com/sanmai/5916333/raw/Getty_Images_Flickr_Helper.user.js
// ==/UserScript==
var currentPhoto = '', stylesAdded = false;
@sanmai
sanmai / Yahoo!_Japan_Auctions_Helper.user.js
Created July 15, 2013 06:53
This little helper donwloads and embeds each NABY message right under a link to one.
// ==UserScript==
// @name Yahoo! Japan Auctions Helper
// @namespace http://userscripts.org/users/163777
// @include http://page*.auctions.yahoo.co.jp/show/contact*
// @include http://page*.auctions.yahoo.co.jp/jp/show/contact*
// @require http://code.jquery.com/jquery.min.js
// @version 1.0
// ==/UserScript==
$('a[onclick][href^="/show/contact_detail"]').each(function () {
@sanmai
sanmai / UIImage+Scale.h
Last active January 20, 2021 23:23
If you just want an UIImage smaller and don't care about exact sizing, this category is for you. It extends the UIImage class to support scaling. Methods should be pretty self-explanatory.
// Created by Alexey Kopytko in 2013.
// Public domain with no warranty whatsoever.
// Extends the UIImage class to support scaling
@interface UIImage (Scale)
- (UIImage *)imageScaledToQuarter;
- (UIImage *)imageScaledToHalf;
- (UIImage *)imageScaledToScale:(CGFloat)scale;
- (UIImage *)imageScaledToScale:(CGFloat)scale
@sanmai
sanmai / prepare-commit-msg.sh
Last active December 23, 2015 08:28 — forked from bartoszmajsak/prepare-commit-msg.sh
Leaves as is any commit message other than for new commits.
#!/bin/bash
if [[ "$2" == "message" || -z "$2" ]]; then
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
if [[ -n "$BRANCH_NAME" && "$BRANCH_NAME" != "master" ]]; then
echo "$BRANCH_NAME: $2 $(cat $1)" > $1
fi
fi
@sanmai
sanmai / build.sh
Last active August 29, 2015 13:57
NGiNX_HTTP_Push_Module internal redirect test case
#!/bin/bash
cd nginx-1.4.6
./configure --add-module=../nginx_http_push_module/ --with-http_perl_module
make "$@"
@sanmai
sanmai / hide-referer.conf
Last active December 26, 2023 01:35
Hide referer header for outbound links with the power of nginx. For this to work you must use it within a https-enabled server.
# Usage:
# https://www.example.com/hide-referer?http://en.wikipedia.org/wiki/HTTP_referer
server {
server_name www.example.com;
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
@sanmai
sanmai / intelligence.md
Last active August 29, 2015 14:00
Модель сознания

Обоснование модели А

За неимением лучшего, использую общепринятую терминологию для упрощения понимания.

Многие утверждения ниже приводятся без доказательств, в первую очередь потому что их доказательства будут довольно объемны и смысла отвлекаться на них сейчас автор не видит, считая что правильно будет вернуться к доказательствам отдельно.

Гипотеза функций сознания

В процессах в сознании можно выделить ряд аспектов по критериям субъективности и объективности, отношений и свойств, суждения и восприятия. Назовем из функциями сознания.