Skip to content

Instantly share code, notes, and snippets.

Avatar

Anjaneyulu Batta AnjaneyuluBatta505

View GitHub Profile
View aws-cognito-boto3.py
client = boto3.client(
'cognito-idp', region_name="ap-southeast-1",
**{
'aws_access_key_id': "",
'aws_secret_access_key': ""
})
View deploy.sh
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
View data_migration.py
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 Apr 1, 2020 — forked from konojunya/main.go
Sample using gin's BindJSON
View main.go
package main
import (
"fmt"
"log"
"github.com/gin-gonic/gin"
)
type CreateParams struct {
View kubernetes_commands.md
@AnjaneyuluBatta505
AnjaneyuluBatta505 / redis_migrate.py
Created Feb 21, 2020 — forked from josegonzalez/redis_migrate.py
A simple script to migrate all keys from one Redis to another
View redis_migrate.py
#!/usr/bin/env python
import argparse
import redis
def connect_redis(conn_dict):
conn = redis.StrictRedis(host=conn_dict['host'],
port=conn_dict['port'],
db=conn_dict['db'])
return conn
@AnjaneyuluBatta505
AnjaneyuluBatta505 / wifi.py
Created Sep 13, 2019 — forked from taylor224/wifi.py
Python WiFi Example
View wifi.py
# -*- coding: utf-8 -*-
import wifi
def Search():
wifilist = []
cells = wifi.Cell.all('wlan0')
@AnjaneyuluBatta505
AnjaneyuluBatta505 / element_in_viewport.js
Created May 27, 2019
check if element is in viewport
View element_in_viewport.js
function elementInViewport2(el) {
var top = el.offsetTop;
var left = el.offsetLeft;
var width = el.offsetWidth;
var height = el.offsetHeight;
while(el.offsetParent) {
el = el.offsetParent;
top += el.offsetTop;
left += el.offsetLeft;
View fetch-requests.js
const getQueryString = params => {
return Object.keys(params)
.map(k => {
if (Array.isArray(params[k])) {
return params[k]
.map(val => `${encodeURIComponent(k)}[]=${encodeURIComponent(val)}`)
.join("&");
}
return `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`;
@AnjaneyuluBatta505
AnjaneyuluBatta505 / Loading.js
Created Apr 9, 2019
react js loading component
View Loading.js
import React, { Component } from "react";
import { ActivityIndicator, View } from "react-native";
import {StyleSheet} from 'react-native'
const styles = StyleSheet.create({
loading: {
flex: 1,
flexDirection: "row",
alignItems: 'center'
},