Skip to content

Instantly share code, notes, and snippets.

View zzet's full-sized avatar
🎯
I may be slow to respond.

Andrew Kumanyaev zzet

🎯
I may be slow to respond.
View GitHub Profile
@zzet
zzet / semantic-commit-messages.md
Created January 8, 2020 18:14 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

# lens_client/lib/lens/allocations_data.rb
module Lens
if RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '1.9'
require 'objspace'
class AllocationsData
def initialize
@enabled = false
@objects_count = 0
@objects_memory = 0
@zzet
zzet / gist:80211e14b8d7242cee97
Last active August 29, 2015 14:14
Install erlang
#!/bin/sh
# Debian has older Erlang package (R15) in official repositories, we requires newer (R17)
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install -y erlang
rm erlang-solutions_1.0_all.deb
SELECT idx.relname as table,
idx.indexrelname as index,
pg_relation_size( idx.indexrelname::text ) as bytes,
cls.relpages as pages,
cls.reltuples as tuples,
idx.idx_scan as scanned,
idx.idx_tup_read as read,
idx.idx_tup_fetch as fetched
FROM pg_stat_user_indexes idx,
pg_class cls ,
#!/bin/bash
git filter-branch --tag-name-filter 'cat' --tree-filter '
if [ -f .gitmodules ];
then
cat .gitmodules | sed -e "s/\+[a-zA-Z]*\///g" >> .tmpgitmodules && mv .tmpgitmodules .gitmodules;
else
echo "";
fi' -- --all
use std::io;
use std::string::String;
use std::io::{File, Append, ReadWrite};
use std::io::process::{Command};
static hexlet_git_log_filename : &'static str = "hexlet-git-log";
fn main() {
// Create log file
match File::create(&Path::new(hexlet_git_log_filename)) {
@vals = []
def happy_number?(n)
seen={}
begin
seen[n] = true
n = n.to_s.each_char.map { |x| x.to_i ** 2 }.reduce { |x,y| x + y }
end until seen[n]
return n == 1
end
-> % bundle exec pry
[1] pry(main)> require 'gitlab_git'
=> true
[2] pry(main)> r = Gitlab::Git::Repository.new('.')
=> #<Gitlab::Git::Repository:0x007f85ae7cd860
@name=".",
@path=".",
@root_ref="feature/diff_from_rugged",
@rugged=
#<Rugged::Repository:70106067397580 {path: "/Users/zzet/projects/opensourse/gitlab_git/.git/"}>>
$ bundle
Fetching git://github.com/libgit2/rugged.git
remote: Counting objects: 8700, done.
remote: Compressing objects: 100% (2978/2978), done.
remote: Total 8700 (delta 4597), reused 8443 (delta 4439)
Receiving objects: 100% (8700/8700), 18.28 MiB | 451 KiB/s, done.
Resolving deltas: 100% (4597/4597), done.
remote: Counting objects: 46359, done.
remote: Compressing objects: 100% (13567/13567), done.
Receiving objects: 100% (46359/46359), 15.77 MiB | 1.61 MiB/s, done.
[1] pry(main)> start = Time.now; Rugged::Repository.new(Project.find_with_namespace('infrastructure/gitlab').repository.path_to_repo).diff("14798b8e686aafaa9ea3bc9b18294fefa54801f5", "211c433cd89ddc49b1f8c3ef6ba7bc366428a851").each_patch { |patch| puts; p patch.delta; puts; patch.hunks.first.lines.each {|l| p l } }; p "Finished in #{Time.now - start} seconds."
Namespace Load (69.9ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."path" = 'infrastructure' LIMIT 1
Project Load (1.2ms) SELECT "projects".* FROM "projects" WHERE "projects"."namespace_id" = 3900 AND "projects"."path" = 'gitlab' LIMIT 1
Namespace Load (73.0ms) SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."id" = $1 ORDER BY "namespaces"."id" ASC LIMIT 1 [["id", 3900]]
"run native commnd in GRIT: 'rev-parse'; with options: '{}'; with args: [\"HEAD\"]"
"run native commnd in GRIT: 'rev-parse'; with options: '{}'; with args: [\"HEAD\"]"
#<Rugged::Diff::Delta:86854160 {old_file: {:oid=>"0000000000000000000000000000000