This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base: | |
prop = 42 | |
other = 1 | |
def func(self): | |
print('Base func') | |
return self.prop | |
class Child(Base): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swapon -s | |
cp /etc/fstab /etc/fstab.bak | |
# For 4 CPU Core create 4 swap files: | |
for i in $(seq 0 3); do | |
fallocate -l 1G /swapfile$i; | |
mkswap /swapfile$i; | |
swapon /swapfile$i -p 10 | |
echo "/swapfile$i none swap sw 0 0" >> /etc/fstab; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ssh_connection] | |
pipelining=True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git grep -l installed|xargs sed -e "s/installed/present/g" -i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#address").suggestions({ | |
token: "5ef98f5781a106962077fb18109095f9f11ebac1", | |
type: "ADDRESS", | |
count: 10, | |
onSuggestionsFetch: function (suggestions) { | |
var instance = $(this).data('suggestions'); | |
var data = { | |
"locations": [{"street_type_full": "метро"}], | |
"restrict_value": false, | |
"query": instance.currentValue, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#address").suggestions({ | |
token: "5ef98f5781a106962077fb18109095f9f11ebac1", | |
type: "ADDRESS", | |
count: 20, | |
onSuggestionsFetch: function (suggestions) { | |
var items = []; | |
$.each(suggestions, function (i, item) { | |
if (item.value.indexOf('метро') != -1) { | |
items.splice(0, 0, item); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% curl "https://api.github.com/repos/smappi/smappi/commits?path=README.md"|head -n42 | |
{ | |
"sha": "01379e9475822e439749dbfc0ef3d9bcc4939601", | |
"node_id": "MDY6Q29tbWl0MTA4MTM0MDU3OjAxMzc5ZTk0NzU4MjJlNDM5NzQ5ZGJmYzBlZjNkOWJjYzQ5Mzk2MDE=", | |
"commit": { | |
"author": { | |
"name": "Mikhail Andreev", | |
"email": "[email protected]", | |
"date": "2018-07-13T12:10:50Z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: from git import Repo, Commit | |
In [2]: repo = Repo('/tmp/xxx') | |
In [3]: list(repo.iter_commits('master', 'README.md', max_count=1))[0].author | |
Out[3]: <git.Actor "Mikhail Andreev (adw0rd) <[email protected]>"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from git import Repo, Commit | |
repo = Repo.clone_from('[email protected]:smappi/smappi.git', '/tmp/xxx') | |
# repo = Repo('/tmp/xxx') | |
commits = list(repo.iter_commits('master', max_count=5)) | |
[{'name': str(c.author), 'email': c.author.email, 'msg': c.message} for c in commits] | |
>>> | |
[{'name': 'Mikhail Andreev (adw0rd)', | |
'email': '[email protected]', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep (seconds) { | |
let start = new Date; | |
while (((new Date) - start) / 1000 < seconds) {} | |
} | |
// console.log('Start', new Date) | |
// sleep(5) | |
// console.log('End', new Date) | |
module.exports = { sleep } |