Skip to content

Instantly share code, notes, and snippets.

View pbteja1998's full-sized avatar

Bhanu Teja Pachipulusu pbteja1998

View GitHub Profile
@pbteja1998
pbteja1998 / scopes.txt
Created September 22, 2017 17:28 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@pbteja1998
pbteja1998 / readme.md
Created November 22, 2017 07:07 — forked from vinaypuppal/readme.md
GITHUB_OAUTH
  • On Frontend
    • User clicks Login With Github Button.
    • We redirect user to https://github.com/login/oauth/authorize with client_id, redirect_uri and scope as query params.
    • Example
      https://github.com/login/oauth/authorize?scope=user:email&client_id=<CLIENT_ID>&state=<state>
      
    • Once user allows access github redirect back us to supplied redirect_uri with code as query parameter.
    • Example
def sign_data(private_key, hashed_data):
'''
param: private_key
param: hashed_data SHA256 hash of data to be signed
return: base64 encoded signature
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from base64 import b64encode
key = private_key
def verify_sign(public_key, signature, hashed_data):
'''
Verifies with a public key from whom the data came that it was indeed
signed by their private key
param: public_key
param: signature String signature to be verified
return: Boolean. True if the signature is valid; False otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
def generate_RSA(bits=2048):
'''
Generate an RSA keypair with an exponent of 65537 in PEM format
param: bits The key length in bits
Return private key and public key
'''
from Crypto.PublicKey import RSA
new_key = RSA.generate(bits, e=65537)
public_key = new_key.publickey().exportKey("PEM")
private_key = new_key.exportKey("PEM")
def hash_data(data):
'''
param: data b64encoded data
return: SHA256 base64 encoded hash
'''
from base64 import b64decode
from Crypto.Hash import SHA256
hashed_data = SHA256.new()
hashed_data.update(b64decode(data))
return hashed_data
@pbteja1998
pbteja1998 / sidekiq_delete_jobs.md
Created July 3, 2018 11:44 — forked from eparreno/sidekiq_delete_jobs.md
How to delete Sidekiq jobs in a Rails app using ActiveJobs

How to delete Sidekiq jobs in a Rails app using ActiveJobs

Sidekiq jobs can be enqueued or scheduled. Enqueued means that they are gonna be picked up as soon as possible, scheduled jobs will be enqueued at some specific time.

job_id and jid

When using ActiveJobs, Rails will return a job_id after sending the job to ActiveJobs

job = UserMailer.send_invite(params).deliver_later
@pbteja1998
pbteja1998 / Python_sax_template.py
Created August 22, 2018 09:08 — forked from veryhappythings/Python_sax_template.py
As basic as a python SAX parser can get.
import sys, string
from xml.sax import saxutils, handler, make_parser
class ContentGenerator(handler.ContentHandler):
def __init__(self, out = sys.stdout):
handler.ContentHandler.__init__(self)
@pbteja1998
pbteja1998 / generate-shadow-outline.tailwind.config.js
Last active September 30, 2020 11:59
This will generate `shadow-outline-*` utilities for all the colors (including your own custom-defined colors).
const colors = require('@tailwindcss/ui/colors')
module.exports = {
// ...
theme: {
// ...
extend: {
// ...
colors: {
brand: colors.indigo,
@pbteja1998
pbteja1998 / ux-ui.md
Last active October 20, 2020 11:10 — forked from duttakapil/ux-ui.md
UI and UX Curriculum

User-Centric Design Research

  • Qualitative and Quantitative Research Practices
  • Information Architecture and Flow
  • User Need Identification
  • User Experience Interviewing
  • Proto-Personas
  • Insight Synthesis

Visual Prototyping and Wireframing

  • Adobe Photoshop