Skip to content

Instantly share code, notes, and snippets.

👨‍💻
django + react => new products coming soon

Lokesh Sanapalli lokesh1729

👨‍💻
django + react => new products coming soon
Block or report user

Report or block lokesh1729

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
View QHEAP1.java
import java.util.HashMap;
import java.util.Scanner;
public class QHEAP1 {
private static int count = 1;
private static MinimumHeap<Integer> root = null;
HashMap<Integer,Integer> h = new HashMap<>();
public static void main(String args[]) {
long startTime = System.currentTimeMillis();
Scanner sc = new Scanner(System.in);
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
View Default%20%28OSX%29.sublime-keymap
[
{ "keys": ["command+["], "command": "jump_back" },
{ "keys": ["command+]"], "command": "jump_forward" },
]
View get_nested_values_from_dict.py
def get_nested_values_from_dict(data, attrs, index=0):
"""
get values from nested dictionary
Example:
>>> data = {"a": {"b": {"c": 3}}
>>> get_nested_values_from_dict(data, ["a", "b", "c"])
>>> 3
:param data: dict
:param attrs: list
:param index: int
View producer_consumer.py
import concurrent.futures
import logging
import random
import threading
SENTINEL = object()
View asyncio_requests
import asyncio
import json
import time
import aiohttp
result = []
async def download_site(session, url):
View threading_requests.py
import concurrent.futures
import json
import time
import requests
URLS = [
"https://reqres.in/api/users",
"http://dummy.restapiexample.com/api/v1/employees",
# "https://jsonplaceholder.typicode.com/todos",
# "https://jsonplaceholder.typicode.com/posts",
@lokesh1729
lokesh1729 / prettier-eslint-react-config
Last active Jul 2, 2019
#prettier #eslint config for #react
View prettier-eslint-react-config
# package.json
{
"devDependencies": {
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^5.0.0",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-react": "^7.14.1",
"husky": "^2.5.0",
"lint-staged": "^8.2.1",
"prettier": "^1.18.2",
@lokesh1729
lokesh1729 / base62_encode.py
Last active Jul 17, 2019
#python #url #shortid #short #base62 #base64
View base62_encode.py
BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def encode(num, alphabet=BASE62):
"""Encode a positive number in Base X
Arguments:
- `num`: The number to encode
- `alphabet`: The alphabet to use for encoding
"""
if num == 0:
@lokesh1729
lokesh1729 / divide_array_sub_arrays_v1.py
Created Jul 10, 2019
divide an array into contiguous k sub arrays
View divide_array_sub_arrays_v1.py
def divide(data, n_column=3):
result = []
cur_index = 0
n = len(data)
while cur_index < n/n_column:
result.append(data[cur_index*n_column: (cur_index+1)*n_column])
cur_index += 1
if n%n_column != 0:
result.append(data[cur_index*n_column: (cur_index+1)*n_column])
return result
You can’t perform that action at this time.