Skip to content

Instantly share code, notes, and snippets.

View AnjaneyuluBatta505's full-sized avatar

Anjaneyulu Batta AnjaneyuluBatta505

View GitHub Profile
@AnjaneyuluBatta505
AnjaneyuluBatta505 / array_of_arrays.sql
Created November 16, 2018 12:53
merge array of arrays in postgresql with array_agg
--select ARRAY(select distinct unnest(array_agg(category.arr)))
select ARRAY(select distinct unnest(array[array[1,2,3], array[4,2,8]]))
@AnjaneyuluBatta505
AnjaneyuluBatta505 / wkhtmltopdf.sh
Created December 6, 2018 13:40 — forked from faniska/wkhtmltopdf.sh
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@AnjaneyuluBatta505
AnjaneyuluBatta505 / env_us-east-1.yml
Created February 3, 2022 09:10 — forked from adhorn/env_us-east-1.yml
Serverless framework to support deploy Lambda Functions in VPC
STATUS: 200
lambdaExecSecurityGroups: ["sg-xxxxxxx"]
subnets: ["subnet-xxxxxxx"]
@AnjaneyuluBatta505
AnjaneyuluBatta505 / iterm2.md
Created September 21, 2021 12:53 — forked from nobitagit/iterm2.md
iterm2 cheatsheet

This gist has been moved to its own Github repo, so it's easier to contribute with additions and corrections. Please open a PR there if you see any mistake, I don't track comments on here as there's no notification system for gists AFAIK. Thanks.

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
@AnjaneyuluBatta505
AnjaneyuluBatta505 / gpg_fix.txt
Created September 7, 2021 08:32 — forked from cezaraugusto/gpg_fix.txt
fixing `gpg failed to sign data` error on macOS
For troubleshooting, two things to first try:
run `git config --global gpg.program gpg2`, to make sure git uses gpg2 and not gpg
run `echo "test" | gpg2 --clearsign`, to make sure gpg2 itself is working
If that all looks all right, one next thing to try:
run `brew install pinentry` to ensure you have a good tool installed for passphrase entry
If after that install and you re-try git commit and still get the "failed to sign the data" error:
run `gpgconf --kill gpg-agent` to kill any running agent that might be hung
@AnjaneyuluBatta505
AnjaneyuluBatta505 / Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Created July 26, 2018 07:09 — forked from IamAdiSri/Python3, Pip3, Virtualenv and Virtualenvwrapper Setup
Setting up and using Python3, Pip3, Virtualenv (for Python3) and Virtualenvwrapper (for Python3)
First install pip for Python2. Download the get-pip.py file from https://bootstrap.pypa.io/get-pip.py
$ cd <download location>
$ sudo -H python ./get-pip.py
Installing pip also installs Python3
To run Python3
$ python3
Install pip3 by just executing the same file as in the step above, but this time using Python3
$ sudo -H python3 ./get-pip.py
client = boto3.client(
'cognito-idp', region_name="ap-southeast-1",
**{
'aws_access_key_id': "",
'aws_secret_access_key': ""
})
cd ~/project/payslip-visualisation/
branch="$(git name-rev --name-only HEAD)"
git checkout $branch
git pull origin $branch
source ~/.virtualenvs/finklim/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py collectstatic --no-input
sudo supervisorctl restart all
import glob, os
import pathlib
from django.apps import apps
from django.db.models.fields.related import OneToOneField, ForeignKey
from collections import OrderedDict
from django.template import Template, Context
from django.db import connection
def execute_raw_sql(query):
@AnjaneyuluBatta505
AnjaneyuluBatta505 / main.go
Created April 1, 2020 05:24 — forked from konojunya/main.go
Sample using gin's BindJSON
package main
import (
"fmt"
"log"
"github.com/gin-gonic/gin"
)
type CreateParams struct {