Skip to content

Instantly share code, notes, and snippets.

View mvcaaa's full-sized avatar
🏠
Working from home

Andrey Astashov mvcaaa

🏠
Working from home
View GitHub Profile
http://stackoverflow.com/questions/5772192/git-how-can-i-reconcile-detached-head-with-master-origin
First, lets clarify what HEAD is and what it means when it is detached.
HEAD is the symbolic name for the currently checked out commit. When HEAD is not detached (the “normal”1 situation: you have a branch checked out), HEAD actually points to a branch’s “ref” and the branch points to the commit. HEAD is thus “attached” to a branch. When you make a new commit, the branch that HEAD points to is updated to point to the new commit. HEAD follows automatically since it just points to the branch.
git symbolic-ref HEAD yields refs/heads/master
The branch named “master” is checked out.
git rev-parse refs/heads/master yield 17a02998078923f2d62811326d130de991d1a95a
@mvcaaa
mvcaaa / gist:5400276
Last active December 16, 2015 07:39
Simple tourdom parser
# Simple CLI tourdom.ru crawler/parser
# To exec: ruby index.rb
# (C) Astashov Andrey <[email protected]>
# require 'rubygems'
require 'restclient'
require 'nokogiri'
require 'digest/md5'
require 'time'
<?PHP
if(!isset($_SESSION)){
if (rand(0,10) > 5) {
session_start();
} else {
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://new.vsesvetodiody.ru//");
}
}
?>
<?PHP
$interestingCrawlers = array( 'yandex', 'google', 'yahoo' );
$pattern = '/(' . implode('|', $interestingCrawlers) .')/';
$matches = array();
if(!isset($_SESSION)){
if (rand(0,10) > 5) {
session_start();
} else {
@mvcaaa
mvcaaa / Test.js
Created September 30, 2015 11:01
angular.module("App").run(["$templateCache", function($templateCache) {$templateCache.put("app/components/country/country.view.tpl.html"," <div class=\"container\">\n\n <form action=\"{{formTarget}}\" method=\"post\" role=\"geoform\" id=\"geoform\" style=\"margin-right:30px\">\n\n <div class=\"form-group\">\n <label for=\"country\">Country:</label>\n <select id=\"country\" name=\"country\" ng-model=\"country\" class=\"form-control\">\n <option value=\"\">Select Country</option>\n <option ng:repeat=\"country in countries\" value=\"{{country.code}}\">{{country.name}}</option>\n </select>\n </div>\n\n <div class=\"form-group\" ng-show=\"country != \'\'\">\n <label for=\"zipcode\">Zipcode:</label>\n <input ng-model=\"zipcode\" id=\"zipcode\" name=\"zipcode\" type=\"text\" placeholder=\"Zipcode\" class=\"form-control\"/>\n </div>\n\n <div class=\"form-group\" ng-show=\"country == \'NL\'\">\n <label for=\"houseNumber\">House Number:</label>\n <input ng-model=\"houseNumber\" i
<?PHP
$de_cp1251 = array(
0x0080 => 0x0402, # CYRILLIC CAPITAL LETTER DJE
0x0081 => 0x0403, # CYRILLIC CAPITAL LETTER GJE
0x0082 => 0x201a, # SINGLE LOW-9 QUOTATION MARK
0x0083 => 0x0453, # CYRILLIC SMALL LETTER GJE
0x0084 => 0x201e, # DOUBLE LOW-9 QUOTATION MARK
0x0085 => 0x2026, # HORIZONTAL ELLIPSIS
0x0086 => 0x2020, # DAGGER
0x0087 => 0x2021, # DOUBLE DAGGER
<?php
/**
* FIXME: This is first working version of the script.
* I do not like it - not optimal and broke DRY, needs to be refactored
*
* Usage example:
*
* $strFolderName = $argv[1] ? $argv[1] : '.';
* var_dump(mainFunc($strFolderName, FORMAT_ARRAY));
<?php
/**
* FIXME: This is first working version of the script.
* I do not like it - not optimal and broke DRY, needs to be refactored
*
* Usage example:
*
* $strFolderName = $argv[1] ? $argv[1] : '.';
* var_dump(mainFunc($strFolderName, FORMAT_ARRAY));
<!--
/**
* Created by Astashov Andrey <[email protected]>
* Date: 20.01.2017 / 01:00
*/
-->
<script>
var objs = {
"1":{
"count":10,
  • Update apparmor rules
curl -L https://gist.github.com/raw/67672ea297213b830e876c5489c06b99 > /etc/apparmor.d/abstractions/php7
curl -L https://gist.github.com/raw/89af8525ebfbe2ad36d755d5a8b21bdd > /etc/apparmor.d/usr.sbin.php-fpm7.0
curl -L https://gist.github.com/raw/d97677cb51b7b23641e6ed9f8bcfd674 > /etc/apparmor.d/usr.sbin.nginx
service apparmor reload
  • Install php7