Skip to content

Instantly share code, notes, and snippets.

View gowthamsadasivam's full-sized avatar
🎯
Focusing

Gowtham Sadasivam gowthamsadasivam

🎯
Focusing
View GitHub Profile

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@gowthamsadasivam
gowthamsadasivam / Fix-Ubuntu-GPG-Resource-Limits.txt
Created September 19, 2017 06:15
[Ubuntu] Fix gpg resource limits and missing keys
### The solution is to empty the "/etc/apt/trusted.gpg.d", run "apt-get update" and then manually adding every key it blocked on to the main "/etc/apt/trusted.gpg" keyring with apt-key adv as described.
### FROM https://medium.com/@foxoman/ubuntu-tip-fix-gpg-resource-limits-and-missing-keys-ec7f1da4c02
### TESTED ON Ubuntu 14.04.4
sudo mv /etc/apt/trusted.gpg.d/ /etc/apt/trusted.gpg.d.backup
sudo mkdir /etc/apt/trusted.gpg.d
sudo chmod 755 /etc/apt/trusted.gpg.d
sudo apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $key ; done
ifcfg-bond0
DEVICE=bond0
NAME=bond0
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
ONBOOT=yes
BOOTPROTO=none
BONDING_MASTER=yes
BONDING_OPTS="mode=4 miimon=100 downdelay=0 updelay=0 lacp_rate=fast xmit_hash_policy=1"
@gowthamsadasivam
gowthamsadasivam / answer.txt
Created August 10, 2017 10:09
PackStack Test Configuration
[general]
# Path to a public key to install on servers. If a usable key has not
# been installed on the remote servers, the user is prompted for a
# password and this key is installed so the password will not be
# required again.
CONFIG_SSH_KEY=/root/.ssh/id_rsa.pub
# Default password to be used everywhere (overridden by passwords set
# for individual services or users).
@gowthamsadasivam
gowthamsadasivam / gist:98eadc173d2bea71b2315385dfefdf26
Created July 7, 2017 07:51 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@gowthamsadasivam
gowthamsadasivam / binfile2pycode.py
Created March 14, 2017 06:58 — forked from usernaamee/binfile2pycode.py
Create self extracting python 2.6+ source code from any binary file
"""
:|
- Email provider doesn't allow me to send certain file types.
- I have python installed on all my machines.
- Inflates the file size by ~4.5X, still remains under 25M for me.
"""
from __future__ import print_function
import sys
@gowthamsadasivam
gowthamsadasivam / recover_source_code.md
Created March 13, 2017 10:02 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@gowthamsadasivam
gowthamsadasivam / Optimized .htaccess
Last active August 29, 2015 14:08
Default Apache HTTP Server Configuration File - .htaccess
RewriteEngine on
# Redirect non-www URLs to www URL - Canonical URL redirection
# Replace YOURDOMAIN.TLS with your actual domain name
RewriteCond %{HTTP_HOST} !^www.YOURDOMAIN.TLS$ [NC]
RewriteRule ^(.*)$ http://www.YOURDOMAIN.TLS/$1 [L,R=301]
# Replace 0.0.0.0 with YOUR (SHARED/DEDICATED)IP ADDRESS
RewriteCond %{HTTP_HOST} ^0.0.0.0$ [NC]
RewriteRule (.*)$ http://www.YOURDOMAIN.TLS/$1 [R=301,L]
ErrorDocument 404 /404.html
@gowthamsadasivam
gowthamsadasivam / Canonical URL redirection using JavaScript
Last active August 29, 2015 14:08
Canonical URL redirection from non-www to www
<script>
var www = window.location.href;
if(www.search('www')==-1){
window.location.href='http://www.'+window.location.host+window.location.pathname;
}</script>
@gowthamsadasivam
gowthamsadasivam / Facebook Tab App Redirect
Last active December 28, 2015 23:29
Facebook tab app redirect for the canvas page using Javascript
<script type="text/javascript">
if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
//it's a mobile device check we're inside an iFrame or not
if (top == self) {
//Not in iFrame redirect to application URL
top.location = "https://www.facebook.com/MyPage/?sk=app_xxxxxxxxxxx&ref=ts";
}
} else {
//NOT a mobile device check we're inside an iFrame or not
if (top == self) {