Skip to content

Instantly share code, notes, and snippets.

View vamsiikrishna's full-sized avatar
🎯

Vamsi Krishna B vamsiikrishna

🎯
  • Bengaluru - India
View GitHub Profile
@vamsiikrishna
vamsiikrishna / API.md
Created October 6, 2015 12:15 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@vamsiikrishna
vamsiikrishna / nginx.conf
Created October 7, 2015 11:04 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@vamsiikrishna
vamsiikrishna / gist:636100e436db5e78774e
Created December 16, 2015 06:20 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@vamsiikrishna
vamsiikrishna / fact_closure.php
Created July 13, 2016 08:06
Factorial of a number using Closure in PHP
<?php
$factorial = function($n) use (&$factorial) {
if($n <= 1)
return 1;
else
return $n * $factorial($n -1);
};
echo $factorial(5).PHP_EOL;
@vamsiikrishna
vamsiikrishna / rbenv-howto.md
Created October 12, 2016 14:56 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@vamsiikrishna
vamsiikrishna / project_euler_2.php
Created October 20, 2016 04:16
Problem 2 - Project Euler in PHP
<?php
list($a, $b) = [1,1];
$total = 0;
while($a <= 4000000) {
if($a % 2 === 0) {
$total += $a;
}
list($a, $b) = [$b, $a+$b];
}
echo $total;
@vamsiikrishna
vamsiikrishna / splat_demo.php
Created January 23, 2017 09:46
demo splat operator in PHP
function add($a, $b, $c) {
return $a + $b + $c;
}
$arr = [1,2,3];
echo add(...$arr);
//6

Keybase proof

I hereby claim:

  • I am vamsiikrishna on github.
  • I am vamsi (https://keybase.io/vamsi) on keybase.
  • I have a public key ASBxPOLYJb1ePgbF6wWQ_c821r9fADPnFtjiWvDezGed8Ao

To claim this, I am signing this object:

[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
{
"name": "Vamsi",
"description": "MY TEST POOL",
"ticker": "VAMSI",
"homepage": "https://github.com/vamsiikrishna/vamsipool"
}