Skip to content

Instantly share code, notes, and snippets.

View Abhinickz's full-sized avatar
💻
Full Stack Developer

Abhishek Bhasker Abhinickz

💻
Full Stack Developer
View GitHub Profile
@josedaniel
josedaniel / md5.js
Created May 2, 2011 14:21
Javascript MD5 Tool
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
@waffle2k
waffle2k / becomeuser.pl
Created August 25, 2011 18:32
Perl script to become a certain user, with some verbose output to describe what's happening
#!/usr/bin/perl
use POSIX qw(setuid getuid);
my $w = scalar getpwuid( $< );
if( $w eq 'root' ){
print "Hey, you're root... let's try to become 'abuse'\n";
# become user abuse
my ($pwName, $pwCode, $pwUid, $pwGid, $pwQuota, $pwComment,
@reyjrar
reyjrar / local-cpan-mirror.txt
Created November 17, 2011 03:14
Local CPAN Mirror Setup, Simply
#=======================================
# Part 1 is Setting up the Mirror Server
# Install CPAN::Mini
$ curl -L http://cpanmin.us | perl - --sudo CPAN::Mini
# Select a CPAN Mirror URL from http://mirrors.cpan.org/
# - We'll use http://cpan.pair.com
# Pick a directory to mirror to, I'll use /var/www/cpan
@emanuelez
emanuelez / git_speed.md
Last active July 1, 2024 05:18
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mkolb
mkolb / var_dump-log.php
Last active January 3, 2023 14:53
var_dump into error log
<?php
ob_start();
var_dump($this);
error_log(ob_get_clean());
?>
@degtyarev-dm
degtyarev-dm / upgrade_perl_modules.pl
Created June 8, 2012 17:21
Reinstall all perl XS-modules, for example after upgrade perl version(App::cpanminus need).
#!/usr/bin/env perl
use strict;
use File::Find;
my @modules=();
my %hash=();
find(\&wanted,@INC);
sub wanted
{
push @modules, $1 if ($File::Find::name =~ /.*?auto\/([A-Z]([\w\d_\/]+)?)\/[\w\d_]+\.so$/);
}
@dsibilly
dsibilly / gist:2992412
Created June 26, 2012 01:00
Node.js clustered HTTP server example
(function () {
'use strict';
var cluster = require('cluster'),
http = require('http'),
os = require('os'),
/*
* ClusterServer object
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active July 18, 2024 22:25
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@chetanmeh
chetanmeh / .bashrc
Last active February 28, 2020 09:48
Script to launch a KDE Konsole window with multiple tabs. It is based on script provided in [Linux Journal](http://www.linuxjournal.com/content/start-and-control-konsole-dbus). It helps to bootstrap development env by launching multiple tabs with preconfigured directory and titles.
source ~/path/to/tabs.sh
load-dev(){
#Create sessi data format '<Tab Name/Title> <Profile Name> <Working Directory>'
local sessions=(
oak Shell 'clear; cd ~/git/apache/oak'
sling Shell 'clear; cd ~/git/apache/sling'
felix Shell 'clear; cd ~/git/apache/felix'
)
start_sessions sessions[@]