Skip to content

Instantly share code, notes, and snippets.

Anjaneyulu Batta AnjaneyuluBatta505

Block or report user

Report or block AnjaneyuluBatta505

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
AnjaneyuluBatta505 /
Created Sep 13, 2019 — forked from taylor224/
Python WiFi Example
# -*- coding: utf-8 -*-
import wifi
def Search():
wifilist = []
cells = wifi.Cell.all('wlan0')
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)}`)
return `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`;
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'
AnjaneyuluBatta505 /
Created Jan 26, 2019 — forked from andreyvit/
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
AnjaneyuluBatta505 / create_normal.html
Created Jan 4, 2019 — forked from taranjeet/create_normal.html
Django Library: Normal form js code
View create_normal.html
<!-- create_normal.html :: part 4 -->
<script type='text/javascript'>
function updateElementIndex(el, prefix, ndx) {
var id_regex = new RegExp('(' + prefix + '-\\d+)');
var replacement = prefix + '-' + ndx;
if ($(el).attr("for")) $(el).attr("for", $(el).attr("for").replace(id_regex, replacement));
if ( =, replacement);
if ( =, replacement);
AnjaneyuluBatta505 /
Created Dec 6, 2018 — forked from faniska/
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 and past to the next line
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 / array_of_arrays.sql
Created Nov 16, 2018
merge array of arrays in postgresql with array_agg
View array_of_arrays.sql
--select ARRAY(select distinct unnest(array_agg(category.arr)))
select ARRAY(select distinct unnest(array[array[1,2,3], array[4,2,8]]))
AnjaneyuluBatta505 /
Created Nov 8, 2018
django: check if given lookup string is valid for given model
from django.db.models.constants import LOOKUP_SEP
from django.core.exceptions import FieldDoesNotExist
# django: check if given lookup string is valid for given model
def is_valid_lookup_field(model, lookup):
# will return first non relational field's verbose_name in lookup
for part in lookup.split(LOOKUP_SEP):
AnjaneyuluBatta505 /
Created Sep 4, 2018 — forked from robgolding/
Django Class-Based View Mixins: Part 1
class LoginRequiredMixin(object):
View mixin which requires that the user is authenticated.
def dispatch(self, request, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(
self, request, *args, **kwargs)
You can’t perform that action at this time.