Skip to content

Instantly share code, notes, and snippets.

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

Vasiliy Bukharev bvp

🏠
Working from home
View GitHub Profile
def humanReadableByteCount(long bytes) {
final int unit = 1024
if (bytes < unit) return bytes + " B"
int exp = (int) (Math.log(bytes) / Math.log(unit))
String pre = ("KMGTPE").charAt(exp-1)
return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre)
}
def objects = 18045181L
def objectSize = 1024L

Keybase proof

I hereby claim:

  • I am bvp on github.
  • I am bvp (https://keybase.io/bvp) on keybase.
  • I have a public key ASB1qSN4VftltMGtyUJCbBlWpxDe2XtdJYK3mr0ayI0qjAo

To claim this, I am signing this object:

body {
padding: 0px;
background: rgb(150,150,150);
}
#container {
width: 824px;
height: 140px;
border: 1px solid black;
border-style: none;
#!/bin/bash
#
# Written by Tobias Lensing, http://tlensing.org
# For more information see http://blog.tlensing.org/2013/02/24/objective-c-on-linux-setting-up-gnustep-clang-llvm-objective-c-2-0-blocks-runtime-gcd-on-ubuntu-12-04/
#
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' curl | grep "install ok installed")
echo Checking for curl: $PKG_OK
if [ "" == "$PKG_OK" ]; then
sudo apt-get install curl -y
@bvp
bvp / bitly.rb
Created June 20, 2012 09:18 — forked from jehiah/bitly.rb
# Bit.ly API implementation - thanks to Richard Johansso http://gist.github.com/112191
require 'httparty'
class Api::Bitly
include HTTParty
base_uri 'api.bit.ly'
format :json
# Usage: Bitly.shorten("http://example.com")
def self.shorten(url)
@bvp
bvp / ProblemOfDrawers.java
Created November 3, 2011 11:30
Решение задачи про 100 открытых шкафчиков
public class ProblemOfDrawers {
/**
* Добавляем префиксный 0 перед цифрой, если она меньше 10
* @param input
* @return
*/
private static String odd(int input) {
String r = String.valueOf(input);
if (input < 10) {
@bvp
bvp / psibuild.command
Created May 22, 2010 16:16
Psi+ build script for Mac OS X
#!/bin/bash
#######################################################################
# #
# Universal build script of Psi+ under MacOS X #
# Универсальный скрипт сборки Psi+ под MacOS X #
# #
#######################################################################
# REQUIREMENTS / ТРЕБОВАНИЯ