Skip to content

Instantly share code, notes, and snippets.

View luvpreetsingh's full-sized avatar
🏠
Working from home

Luvpreet Singh luvpreetsingh

🏠
Working from home
  • GoHighLevel
  • Bengaluru, India
View GitHub Profile
@luvpreetsingh
luvpreetsingh / luvpreet.zsh-theme
Created November 26, 2019 06:06
Custom theme for zsh
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '$' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
echo '○'
}
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/luvpreetsingh/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="customluvpreet"
@luvpreetsingh
luvpreetsingh / Dockerfile
Created July 2, 2019 19:59
Dockerfile for django applications
# syntax=docker/dockerfile:1.0.0-experimental
# The above comment is not to be deleted, its necessary. We are using an experimental feature and above line is important to enable that
# please refer to this, https://medium.com/@tonistiigi/build-secrets-and-ssh-forwarding-in-docker-18-09-ae8161d066 to know more about this
# before building docker image using this dockerfile, please do export DOCKER_BUILDKIT=1
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1

Description and Context

Checklist:

  • Code changes in this pull request follows the code style of this project.
@luvpreetsingh
luvpreetsingh / issue_template.md
Created May 27, 2019 08:17
Template for creating Issues
  • I have checked that this issue is not already reported
SUMMARY
ISSUE TYPE
COMPONENT NAME
@luvpreetsingh
luvpreetsingh / aws_shorthand.sh
Created May 16, 2019 06:10
Simple functions to try aws operations
## Installation of aws-cli,jq is required
# get IP of EC2 instances
getec2ip(){
aws ec2 describe-instances --filters "Name=tag:Name,Values=$1" --region=$2 | jq '.Reservations | .[0] | .Instances | .[0] | .NetworkInterfaces | .[0] | .PrivateIpAddresses | .[0] | .Association | .PublicIp' | cut -d '"' -f 2
}
getec2type(){
aws ec2 describe-instances --filters "Name=tag:Name,Values=$1" --region=$2 | jq '.Reservations | .[0] | .Instances | .[0] | .InstanceType '
}
" enable syntax highlight
syntax enable
" set tabs to have 4 spaces
set ts=4
" indent when moving to the next line while writing code
set autoindent
" convert tabs into spaces
import random
from pilot.models import Station
from django.contrib.gis.geos import Point
cities = ["Chandigarh", "Mumbai", "Ludhiana", "Bangalore", "Goa", "Delhi", "Hyderabad"]
cities_dict = { "Chandigarh": { "lat": "30.7", "lon": "76.7" }, "Mumbai": {"lat": "19.0","lon": "76.7" }, "Bangalore": { "lat": "12.9", "lon": "77.5"}, "Ludhiana": {"lat": "30.9", "lon": "75.8"},"Goa": {"lat": "15.2","lon": "74.1"},"Delhi": {"lat": "28.7","lon": "77.1"},"Hyderabad": {"lat": "17.3","lon": "78.4"},}
for i in range(1,100000):
@luvpreetsingh
luvpreetsingh / elastic.conf
Created August 29, 2017 10:20
Rsyslog Config file to send nginx logs to elasticsearch
# only sending nginx logs. So, use the programname filter.
template(name="all-json"
type="list"){
property(name="$!all-json")
}
if $programname == "nginx" then {