Skip to content

Instantly share code, notes, and snippets.

@Kanst
Kanst / gist:8753705
Created February 1, 2014 15:24
KIT BASH
Команды могут не попасть в историю по следующим причинам:
Если команда попадает под шаблон, определенные в переменной HISTIGNORE. Если в HISTCONTROL установлено значение ignorespace или ignoreboth (не попадут команды, начинающиеся с пробела). Если в HISTCONTROL установлено ignoredups или ignoreboth (не попадут повторяющиеся команды). ignoreboth подходит под оба случая. Также значение этих переменных может быть установлено в /etc/bashrc, а пользователь не переопределит их. Наверно команда может не попасть из-за слишком маленького HISTSIZE.
Чтобы обеспечить запись нужно проверить эти переменные и проверить существование файла HISTFILE и доступ к нему.
@Kanst
Kanst / cap_deploy.sh
Last active December 28, 2015 13:58
cap deploy in commit
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script run cap [-S revision = commit] deploy
example cap_deploy.sh -c 97c902b9d9d29952f33d6c7406859fb946f2bbf8
OPTIONS:
2013-11-14T15:45:33.170855+00:00 heroku[api]: Enable Logplex by [email protected]
2013-11-14T15:45:33.184984+00:00 heroku[api]: Release v2 created by [email protected]
2013-11-14T15:45:56+00:00 heroku[slug-compiler]: Slug compilation started
2013-11-14T15:46:19.234450+00:00 heroku[api]: Scale to web=1 by [email protected]
2013-11-14T15:46:19.255157+00:00 heroku[api]: Add PATH config by [email protected]
2013-11-14T15:46:19.279553+00:00 heroku[api]: Release v3 created by [email protected]
2013-11-14T15:46:19.342305+00:00 heroku[api]: Deploy 1662654 by [email protected]
2013-11-14T15:46:19.389589+00:00 heroku[api]: Release v4 created by [email protected]
2013-11-14T15:46:19+00:00 heroku[slug-compiler]: Slug compilation finished
2013-11-14T15:46:22.707093+00:00 heroku[web.1]: Starting process with command `node app.js`
Counting objects: 697, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (562/562), done.
Writing objects: 100% (697/697), 3.90 MiB | 476 KiB/s, done.
Total 697 (delta 87), reused 687 (delta 84)
-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
=====> Detected Framework: Ruby
#!/usr/bin/python
#! -*- coding: utf-8 -*-
import re
f = open("access.log", "r")
text = f.read()
f.close()
ipv6_find = re.compile('(^|\n)' +\
#!/usr/bin/python
#! -*- coding: utf-8 -*-
import re, tarfile
tar = tarfile.open('etc.tar.gz', 'r:gz')
# Открываем rc-sysinit.conf
rc_file = tar.extractfile('etc/init/rc-sysinit.conf').readlines()
@Kanst
Kanst / gist:7085199
Last active December 26, 2015 03:19
#!/usr/bin/python
#! -*- coding: utf-8 -*-
import re
f = open("input.xml", "r")
text = f.readlines()
f.close()
count = re.compile('^.*(?<=\t| )<boot dev=(\'|\")hd(\'|\").*$')
for x in text:
if x != '\n':
sp = x.split()
out_text.append(sp[3])
max_sec = 0
for x in out_text:
if out_text.count(x) > max_sec:
max_sec = out_text.count(x)
#include <iostream>
#include<vector>
#include<math.h>
using namespace std;
int sum(int a,int b)
@Kanst
Kanst / gist:4171305
Created November 29, 2012 19:35
modelir_dz2
#!/usr/bin/python
# -*- coding: utf-8 -*-
def sum(len,a,b):
if len==2:
aplusb=[[0,1],[1,1]]
elif len == 3:
aplusb=[[0,1,2],[1,1,1],[2,1,2]]
elif len == 5: