Skip to content

Instantly share code, notes, and snippets.

View shoaibi's full-sized avatar

Shoaibi shoaibi

View GitHub Profile
@shoaibi
shoaibi / javascript-notes.md
Last active August 29, 2015 14:23
Javascript notes

General

  • Comment
    • Single line comment: //
    • Multiline comment /* */
  • Combining multiple initialization is better as JS Engine would be faster at executing a single statement
var first = 10,
    second = 15,
 third = "third";
@shoaibi
shoaibi / redshift.conf
Created June 25, 2015 22:04
redshift.conf
; ~/.config/redshift.conf
; Global settings
[redshift]
temp-day=6500K
temp-night=5000
transition=0
;gamma=0.8:0.7:0.8
gamma=1.000:1.000:1.000
location-provider=manual
adjustment-method=vidmode
@shoaibi
shoaibi / liquidpromptrc
Created June 25, 2015 22:04
liquidpromptrc
# ~/.config/liquidpromptrc
####################################
# LIQUID PROMPT CONFIGURATION FILE #
####################################
# If you want to use different themes and features,
# you can load the corresponding files here:
#source ~/.config/liquidprompt/nojhan.theme
#LP_PS1_FILE="~/.config/liquidprompt/nojhan.ps1"
@shoaibi
shoaibi / shoaibi-sysctl.conf
Created June 25, 2015 22:01
My sysctl overrides
# /etc/sysctl.d/99-shoaibi.conf
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288
kernel.hung_task_panic = 1
kernel.hung_task_timeout_secs = 300
kernel.msgmax = 65536
kernel.msgmnb = 65536
kernel.panic = 5
kernel.panic_on_oops = 1
kernel.pid_max = 65536
@shoaibi
shoaibi / pacman-repos.conf
Created June 25, 2015 21:58
My custom pacman repos
[xyne-any]
SigLevel = PackageRequired
Server = http://xyne.archlinux.ca/repos/xyne
[repo-ck]
SigLevel = Never
Server = http://repo-ck.com/$arch
[atlassian]
@shoaibi
shoaibi / restore-permissions.sh
Created June 25, 2015 20:54
A handy script to generate permissions(modes, user and group) restore scripts for /etc directory.
#!/bin/bash
# At the start of my DevOps career I used to mess up /etc permissions
# a lot so I ended up creating 2 set of scripts that would be generated
# on nightly bases using cron and then when required I'd just execute
# these scripts
find /etc -exec stat --format "chmod %a %n" {} \; > /root/restoreperms.sh
find /etc -exec stat --format 'chown %U:%G %n' {} \; > /root/restoreowners.sh
@shoaibi
shoaibi / generate-public-key-from-private-key.sh
Created June 25, 2015 20:51
Generate ssh public key from private key
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
@shoaibi
shoaibi / currency-fair-challenge-architecture-proposal
Created June 25, 2015 20:50
My proposal of how to architect the Currency Fair Trends challenge
Framework of choice: yii2.
Configure application log to log all exceptions.
Configure FileCache(just to have something to later replace, say, by Redis)
2 apps using same configs, same code: frontend, api.
Api application would have a module called v1.
Url pattern: http://app.com/ , http://api.app.com/v1/tradeMessages/consume
Trends:
- Most active user
@shoaibi
shoaibi / java7-notes.md
Last active August 29, 2015 14:23
My Java7 Notes

Java Basics

General

  • For loop, set the comparison condition as variable outside the loop
  • conventions
    • ClassName
    • methodName
    • propertyName
    • CONSTANT_NAME
  • Constants should be static and final. Ideally private too.
@shoaibi
shoaibi / GoogleMapsGeocoder.php
Created June 25, 2015 17:00
A quick and dirty GoogleGeocoder component for Yii v1.0
<?php
class GoogleMapsGeocoder extends CApplicationComponent
{
/**
* @var string
*/
const ENDPOINT_URL = 'http://maps.googleapis.com/maps/api/geocode/json?address=%s';
/**