Skip to content

Instantly share code, notes, and snippets.

View itsprdp's full-sized avatar

Pradeep Gangadharaiah itsprdp

View GitHub Profile
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
fix:
/usr/libexec/git-core/git-rebase--interactive
-git rev-list $merges_option --pretty=oneline --abbrev-commit\
+git rev-list $merges_option --pretty=">%h (%an <%ae>) %s"\
result:
1 pick 19f43c1 (Yuri Dyachenko <yurial@gplvote.org>) add: gcrypt::noerr
2 pick 990a7e8 (Yuri Dyachenko <yurial@gplvote.org>) add: gcrypt::throwif( err ) throw if err != noerr
3 pick cb03f3b (Yuri Dyachenko <yurial@gplvote.org>) add: ext::move<T> move semantic
--- git-rebase--interactive.old 2011-06-11 13:17:48.000000000 +0400
+++ git-rebase--interactive 2012-04-17 12:44:09.000000000 +0400
@@ -951,7 +951,7 @@
REVISIONS=$ONTO...$HEAD
SHORTREVISIONS=$SHORTHEAD
fi
- git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
+ git rev-list $merges_option --pretty=">%h (%an <%ae>) %s"\
--abbrev=7 --reverse --left-right --topo-order \
$REVISIONS | \
# place in lib/tasks/
namespace :sidekiq do
desc "Strano | Stop sidekiq"
task :stop do
system "bundle exec sidekiqctl stop #{pidfile}"
end
desc "Strano | Start sidekiq"
task :start do
#!/usr/bin/env bash
APP_DIR=<%= current_path %>
CURRENT_DIR="cd $APP_DIR"
STAGE=<%= fetch(:stage) %>
DJ_PID="$APP_DIR/tmp/pids/delayed_job.pid"
check_pid(){
if [ -f $DJ_PID ]; then
PID=`cat $DJ_PID`

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@itsprdp
itsprdp / carrier_wave.rb
Created November 12, 2015 11:06 — forked from gshaw/carrier_wave.rb
CarrierWave initialization file for testing with fixtures and support S3 in staging and production.
# NullStorage provider for CarrierWave for use in tests. Doesn't actually
# upload or store files but allows test to pass as if files were stored and
# the use of fixtures.
class NullStorage
attr_reader :uploader
def initialize(uploader)
@uploader = uploader
end
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end
@itsprdp
itsprdp / pg.md
Created March 12, 2017 12:59 — forked from benschwarz/pg.md
Awesome postgres
@itsprdp
itsprdp / client.go
Created May 3, 2018 15:59 — forked from jzelinskie/client.go
grpc bidirectional streams in golang
package main
import (
"log"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
pb "github.com/jzelinskie/grpc/simple"