Skip to content

Instantly share code, notes, and snippets.

Avatar

Kapil Viren Ahuja kvahuja

View GitHub Profile
@kvahuja
kvahuja / setup-user.MD
Last active Nov 27, 2017
Ubuntu Management - Server Setups
View setup-user.MD

User Setup

Add a User

Run the following command to add a new user on a system.

sudo adduser <username>
@kvahuja
kvahuja / Items.php
Created Mar 4, 2017
Vainglory Items
View Items.php
<?php
return [
'*1000_Item_HalcyonPotion*' => 'halcyon-potion',
'Mulled Wine' => 'halcyon-potion',
'*1002_Item_WeaponBlade*' => 'weapon-blade',
'Weapon Blade' => 'weapon-blade',
'*1003_Item_CrystalBit*' => 'crystal-bit',
'Crystal1' => 'crystal-bit',
@kvahuja
kvahuja / Heros.php
Last active Apr 1, 2017
Vainglory API - Mappings
View Heros.php
<?php
return [
'*Adagio*' => 'Adagio',
'*Alpha*' => 'Alpha',
'*Ardan*' => 'Ardan',
'*Baron*' => 'Baron',
'*Blackfeather*' => 'Blackfeather',
'*Catherine*' => 'Catherine',
View db-connect-check.php
<?php
# To run this script use the following command on cli (we assume you have all dependencies installed)
# only checks for mysql for now
# $ php -f db-connect-check.php
$dbhost = 'host';
$dbport = '3306'
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
@kvahuja
kvahuja / Info.php
Created Feb 27, 2017
Check PHP Installation
View Info.php
<?php
phpinfo();
?>
@kvahuja
kvahuja / pg_dump.sh
Created Feb 10, 2017
PgSQL Commands
View pg_dump.sh
# how to generate a dump for postgres
pg_dump --file "dmp.filename.ext" --host "hostname" --port "5432" --username "myusername" --password "changeme" --verbose --role "dbname" --format=c
@kvahuja
kvahuja / scp-upload-file.sh
Last active Feb 7, 2017
Shell Cheat Sheet
View scp-upload-file.sh
scp -i folder/where/private/key/is/placed/key-name.ppk -r source/folder/in/local.machine/* username@host:/folder/in/remote/machine/
View Spring Profiling Aspect Sample
@Aspect
public class ProfilingAspect {
@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
StopWatch sw = new StopWatch(getClass().getSimpleName());
try {
sw.start(pjp.getSignature().getName());
return pjp.proceed();
} finally {
View DecorateThreadNameFilter.java
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
You can’t perform that action at this time.