Skip to content

Instantly share code, notes, and snippets.

View nulltier's full-sized avatar
💭
on my way

Alexander Zonov nulltier

💭
on my way
  • Yandex
View GitHub Profile
@nulltier
nulltier / gist:4163377
Created November 28, 2012 19:11
return string with human readable filesize if you give to this filesize in bytes
def nice_size(size):
if size >= 1073741824:
postfix = " Gb."
divisioner = 1073741824
elif 1048576 <= size < 1073741824:
postfix = " Mb."
divisioner = 1048576
elif 1024 <= size < 1048576:
@nulltier
nulltier / Powershell
Last active August 17, 2017 17:27
usefull commands for ssh-agent in powershell
Get-SshAgent - Returns the process ID of the running agent, or zero if there is not one currently running.
Start-SshAgent - Starts the agent process and sets the appropriate environment variables for SSH.
Stop-SshAgent - Stops the process if there is one and unsets the variables.
Add-SshKey - Instructs the agent to add the given key to itself. This will cause you to be prompted for the passphrase.
@nulltier
nulltier / gist:4311368
Created December 16, 2012 19:03
sublime user settings
{
"color_scheme": "Packages/Dayle Rees Color Schemes/Frontier.tmTheme",
"drag_text": false,
"font_face": "Consolas",
"font_size": 14,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
@nulltier
nulltier / gist:4499599
Created January 10, 2013 05:01
add parent directory in PYTHONPATH
import sys, os
sys.path.append(os.pardir)
@nulltier
nulltier / gist:4757347
Last active December 12, 2015 10:09
Кириллица в python3
class вася():
def курить_бамбук():
print ("пых-пых")
петров = вася
петров.курить_бамбук() # пых-пых
@nulltier
nulltier / gist:4757380
Created February 11, 2013 20:35
Annotations in python3
def bar(x: "широта в градусах"=60):
pass
def foo(x: int, y: int, *args: str) -> int:
pass
bar.__annotations__ # {'x': 'широта в градусах'}
foo.__annotations__ # {'y': <class 'int'>, 'args': <class 'str'>, 'return': <class 'int'>, 'x': <class 'int'>}
from fabric.api import *
import os
import fabric.contrib.project as project
# Local path configuration (can be absolute or relative to fabfile)
env.theme = 'themes/your-theme'
env.deploy_path = '/absolute/path/for/generated/output'
# Remote server configuration
prod = 'username@server.example.com:22'
@nulltier
nulltier / Preferences.sublime-settings
Last active December 16, 2015 07:58
setting for text sublime 3 \Packages\User\Preferences.sublime-settings
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Preferences (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Consolas",
"font_size": 12,
var defaults = {
zero: 0,
one: 1
};
var myOptions = Object.create(defaults);
var yourOptions = Object.create(defaults);
// When I want to change *just* my options
myOptions.zero = 1000;
@nulltier
nulltier / AutoHotkey.ahk
Last active January 9, 2022 15:31
my autohotkey configuration, hotkeys
; <! - left alt-key
; ^ - ctrl-key
; + - shift-key
; sc021 - W
; sc010 - D
; sc011 - F
; sc014 - T
; sc013 - R
; sc024 - J
; sc025 - K