Skip to content

Instantly share code, notes, and snippets.

View asyndrige's full-sized avatar

Stanislaw asyndrige

View GitHub Profile
@asyndrige
asyndrige / tar.sh
Last active January 10, 2019 12:38
for i in */;
do
tar -cvjf "${i%/}.tar" "$i";
done
@asyndrige
asyndrige / genesis_public_key
Created March 5, 2018 09:59
genesis_public_key
04cd1de7985c2346c0003ee18bf9d0df40e007a7151cb5167e926fbf88c24a0c046b4bf5ebaa7438f33cc3e0f0afc479bd2487a76015d808744e8fc179592b89e1
function isMonoPage(docId, page) {
var res;
$scope.orderedDocs.forEach(function(doc) {
if (doc._id.$oid === docId) {
if (doc.pages.indexOf(page) >= 0) {
res = true;
} else if (doc.color_pages.indexOf(page) >= 0) {
res = false;
}
}
var rights_id = db.getCollection('right').find({}, {_id:1}).map(function(item){ return item._id; })
db.getCollection('virtual_reading_room_group').update(
{},
{$push: {rights: {$each: rights_id}}}
);
//////////////////////////
db.getCollection('right').remove({"is_template": true});
# coding=utf-8
import imaplib
import os
import email
import base64
from datetime import datetime
from importlib import import_module
from email.header import decode_header
$(function() {
oscar.init();
var $hrefs = ['#tab-child', '#tab-adult'];
$hrefs.map(function($link){
$('a[href='+$link+']').click(function(e) {
e.preventDefault();
$hrefs.map(function($$link) {
#!/usr/bin/python
import os
import sys
import subprocess
def create_vhost(site_name, site_folder):
conf_string = """<VirtualHost *:80>
ServerName {0}
ServerAdmin webmaster@localhost
#!/usr/bin/python3
import os
import shutil
music = os.path.join('/', 'home', 'stan', 'music')
def fdeleter(dir):
for folder in os.listdir(dir):
path = os.path.join(dir, folder)
/*CategoryController*/
public static function searchCorrection($key)
{
$keyboardLayout = array('`' => 'ё', 'q' => 'й', 'w' => 'ц', 'e' => 'у', 'r' => 'к', 't' => 'е', 'y' => 'н', 'u' => 'г', 'i' => 'ш', 'o' => 'щ', 'p' => 'з', '[' => 'х', ']' => 'ъ', 'a' => 'ф', 's' => 'ы', 'd' => 'в', 'f' => 'а', 'g' => 'п', 'h' => 'р', 'j' => 'о', 'k' => 'л', 'l' => 'д', ';' => 'ж', "'" => 'э', 'z' => 'я', 'x' => 'ч', 'c' => 'с', 'v' => 'м', 'b' => 'и', 'n' => 'т', 'm' => 'ь', ',' => 'б', '.' => 'ю', '/' => '.', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0');
$replace = array('0'=>'7', '1'=>'5', '2'=>'1', '3'=>'8', '4'=>'0', '5'=>'2', '6'=>'9', '7'=>'3', '8'=>'4', '9'=>'6');
$decodedArticleKeyChars = array();
$articleKeyChars = str_replace('а', '', str_replace('f', '', $key));
@asyndrige
asyndrige / gist:d9f7d6c1f3480de3fb55
Last active September 18, 2015 09:45
ManufacturerController
protected function getPartners() {
$partnersRaw = Yii::app()->db->createCommand()->selectDistinct
('ct.name as category_name,
mt.name as manufacturer_name,
c.url as category_url,
m.url, m.id,
p.url as product_url,
p.id as product_id')
->from('StoreCategoryTranslate ct')
->join('StoreCategory c', 'c.id=ct.object_id')