Skip to content

Instantly share code, notes, and snippets.

View paderinandrey's full-sized avatar

Andrey Paderin paderinandrey

View GitHub Profile
@ktheory
ktheory / README.rdoc
Created April 14, 2011 18:12
An example for logging Fog requests in a Rails app

Instrument Fog Requests in Rails

This code adds debug statements to the rails log for each fog reqests (similar to how active record shows SQL queries):

Fog AWS Compute Request (803.0ms)  [ {"Action"=>"DescribeInstances", ...} ]

The end of the request includes cumulative Fog info:

Completed 200 OK in 6043ms (Views: 2955.0ms | ActiveRecord: 319.9ms | Fog: 1642.6ms, 4 reqs)
@mtigas
mtigas / gist:952344
Last active March 20, 2025 09:03
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@boopathi
boopathi / adauth.rb
Created October 15, 2012 09:45
Ruby AD Authentication
# Usage:
# user = ActiveDirectoryUser.authenticate('boopathi','password')
# user.first_name # => "Boopathi"
# user.flanderized_first_name # => "Boopathi Rajaa"
# user.groups # => ["Mac Users", "Geeks", "Ruby Coders", ... ]
require 'net/ldap' # gem install ruby-net-ldap
class ActiveDirectoryUser
### BEGIN CONFIGURATION ###
@xeoncross
xeoncross / fingerprint.php
Last active August 12, 2020 23:37
Generate a fingerprint from and RSA SSH public key
<?php
print "\n";
$rsa = file_get_contents('rsa.pub');
$ssh = file_get_contents('ssh.pub');
// For reference
print $rsa . "\n\n";
print $ssh . "\n\n";
@fabiotatsuo
fabiotatsuo / gist:5429509
Last active July 13, 2020 11:40
Install Erlang
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
wget http://erlang.org/download/otp_src_R15B01.tar.gz
tar zxvf otp_src_R15B01.tar.gz
cd otp_src_R15B01
./configure && make && sudo make install
http://docs.basho.com/riak/latest/tutorials/installation/Installing-Erlang/#Installing-on-GNU-Linux
https://sites.google.com/site/comptekkia/erlang/how-to-install-erlang-on-ubuntu-10-10
@jeffjohnson9046
jeffjohnson9046 / ruby-ldap-sample.rb
Last active January 5, 2024 07:11
Some VERY basic LDAP interaction in Ruby using Net::LDAP.
#######################################################################################################################
# This Gist is some crib notes/tests/practice/whatever for talking to Active Directory via LDAP. The (surprisingly
# helpful) documentation for Net::LDAP can be found here: http://net-ldap.rubyforge.org/Net/LDAP.html
#######################################################################################################################
require 'rubygems'
require 'net/ldap'
#######################################################################################################################
# HELPER/UTILITY METHOD
require 'action_dispatch/middleware/session/abstract_store'
require 'rack/session/abstract/id'
module ActionDispatch
module Session
class RedisStore < Rack::Session::Abstract::ID
include StaleSessionCheck
include Compatibility
attr_reader :server
@denji
denji / nginx-tuning.md
Last active June 28, 2025 15:27
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@mintuhouse
mintuhouse / net_ldap_overrides.rb
Created April 2, 2014 10:51
Verify the certificate of secure LDAP server using net-ldap ruby gem
class Net::LDAP
def initialize(args = {})
@host = args[:host] || DefaultHost
@port = args[:port] || DefaultPort
@verbose = false # Make this configurable with a switch on the class.
@auth = args[:auth] || DefaultAuth
@base = args[:base] || DefaultTreebase
encryption args[:encryption] # may be nil