Skip to content

Instantly share code, notes, and snippets.

View dchest's full-sized avatar
☮️

Dmitry Chestnykh dchest

☮️
View GitHub Profile
# for Mercurial
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH=$HOME/Projects/Scripts:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/bin/checker:/Developer/usr/bin:$PATH
source /usr/local/git/contrib/completion/git-completion.bash
if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
alias la="ls -a"
.DS_Store
*.pbxuser
*.mode1v3
*.pbxproj -crlf -diff -merge
@dchest
dchest / 2text.rb
Created January 8, 2010 23:20
Converting Sellme.ru to text files
#!/usr/bin/ruby
require 'FileUtils'
Dir.glob('**/*.txt', File::FNM_CASEFOLD).each do |filename|
txtname = "../md/" + filename
puts filename + " -> " + txtname
FileUtils.mkdir_p(File.dirname(txtname))
`html2text.py #{filename} > #{txtname}`
end
" Most stuff comes from all over the web.
" A lot of it is from http://items.sjbach.com/319/configuring-vim-right
" Make navigation more amenable to the long wrapping lines.
noremap k gk
noremap j gj
noremap <Up> gk
noremap <Down> gj
noremap \\ :nohlsearch<Return>
@dchest
dchest / i-decided-to-learn-russian-words.txt
Created January 11, 2010 13:53
Пример заметки с Sellme.ru в текстовом виде
# Решил узнать русские слова
Я уже забыл многие программистские термины на русском ([заметку про Lua][1]
пришлось писать на трех языках), а некоторые и совсем не знал, потому что 1)
CS отрасль в России находится в заднице, 2) спал на лекциях, 3) нет литературы
на русском языке, 4) не читаю программистскую литературу на русском языке, 5)
у программеров есть международный язык — код и комментарии в нем (на
английском).
Решил посмотреть термины, которых я не знал. Оказалось, что все словари
@dchest
dchest / gmacs
Created January 18, 2010 23:56
Launch Emacs.app from command line
#!/bin/sh
open -a /Applications/Emacs.app/Contents/MacOS/Emacs $1
@dchest
dchest / .vimrc
Created February 3, 2010 14:15
My Mac .vimrc and other vim-related files
" Most stuff comes from all over the web.
" A lot of it is from http://items.sjbach.com/319/configuring-vim-right
" Make navigation more amenable to the long wrapping lines.
noremap k gk
noremap j gj
noremap <Up> gk
noremap <Down> gj
"noremap \\ :nohlsearch<Return>
@dchest
dchest / .bash_profile (partial)
Created May 7, 2010 15:24
Some things from my .bash_profile
# Aliases
alias la="ls -a"
alias ll="ls -l"
# Show git branch
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1] /'
}
@dchest
dchest / gist:574388
Created September 10, 2010 21:13
How to add a certificate from buffer in OpenSSL
X509 *cert;
char *zCert;
BIO *mem;
zCert = // get your certificate text buffer here (C string with certificate in PEM format)
mem = BIO_new(BIO_s_mem());
BIO_puts(mem, zCert);
cert = PEM_read_bio_X509(mem, NULL, 0, NULL);
free(zCert);
BIO_free(mem);