Skip to content

Instantly share code, notes, and snippets.

View Paxa's full-sized avatar

Pavel Evstigneev Paxa

View GitHub Profile
@ksauzz
ksauzz / install-s3curl.md
Last active December 25, 2015 06:09
Install s3curl

CentOS

wget https://raw.github.com/ksauzz/s3curl/master/s3curl.pl
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
sudo cpanm YAML HTTP::Date Digest::HMAC_SHA1 URI::Escape

cpanminus https://github.com/miyagawa/cpanminus

@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@shime
shime / _README.md
Last active April 2, 2024 17:00
getting tired of guessing tar flags in 2013?

Looks familiar?

Worry no more! Use extract and prosper!

Usage

@ruckus
ruckus / statistics.sql
Created June 5, 2013 23:26
Postgres statistics queries
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
----------------------+--------------+---------------+------------------------
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
@jwo
jwo / silencer.rb
Created January 1, 2013 21:09
JRuby capture of System.out.println
def silencer
require 'java'
java_import 'java.io.PrintStream'
java_import 'java.io.ByteArrayOutputStream'
java_import 'java.lang.System'
sys_out_stream = System.out
my_output_stream = ByteArrayOutputStream.new
@diorahman
diorahman / ssh-to-bb10
Created December 19, 2012 04:02
Connect to your BB10 device through ssh
Create session using blackberry-connect, this tool resides inside your SDK dirs, the host dir i.e
$(BBSDK)/host_10_0_9_404/darwin/x86/usr/bin/blackberry-connect
$ blackberry-connect 169.254.0.1 -password <password> -sshPublicKey ~/.ssh/bb10/id_rsa
Then,
create a config file inside ~/.ssh folder
Host bb10
HostName 169.254.0.1
@ream88
ream88 / Rakefile
Created July 18, 2012 11:24
Minitest rake task
require 'rake'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.test_files = Dir.glob('spec/**/*_spec.rb')
end
task(default: :test)
@steve9001
steve9001 / application.rb
Created December 7, 2011 16:18
Rails middleware to provide information about errors during requests
module MyApp
class Application < Rails::Application
if Rails.env == 'test'
require 'diagnostic'
config.middleware.use(MyApp::DiagnosticMiddleware)
end
end
end
@alexey-bass
alexey-bass / compare.js
Created July 30, 2011 14:03
JavaScript version compare
/**
* Simply compares two string version values.
*
* Example:
* versionCompare('1.1', '1.2') => -1
* versionCompare('1.1', '1.1') => 0
* versionCompare('1.2', '1.1') => 1
* versionCompare('2.23.3', '2.22.3') => 1
*
* Returns: