Skip to content

Instantly share code, notes, and snippets.

View cosmos-sajal's full-sized avatar
🌏
Trying to add meaning to this life.

Sajal Sarwar Sharma cosmos-sajal

🌏
Trying to add meaning to this life.
View GitHub Profile
@cosmos-sajal
cosmos-sajal / Magic Link 1
Last active October 25, 2020 04:21
Magic Link 1
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy import api
from tweepy.streaming import StreamListener
import json
#consumer key, consumer secret, access token, access secret.
ckey="<ckey>"
csecret="<csecret>"
atoken="<atoken>"
@cosmos-sajal
cosmos-sajal / pickling_classifier.py
Created March 14, 2019 08:57
Sentiment Analysis - Model Creation
import nltk
import pickle
from nltk.classify.scikitlearn import SklearnClassifier
def pickling(file, document_name):
save_documemts = open('../pickled_algos/' + document_name + '.pickle', 'wb')
pickle.dump(file, save_documemts)
save_documemts.close()
# let the training_set contains data in the form of -
@cosmos-sajal
cosmos-sajal / plot.py
Created March 14, 2019 09:13
Plotting
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
def animate(i):
# Donald Trump's tweet results were in twitter-out.txt
# Hillary Clinton's tweet results were in twitter-out1.txt
@cosmos-sajal
cosmos-sajal / encryptAESCBC.go
Created October 26, 2023 15:29
Encrypt using AES CBC
func encryptKYCData(plainText string) string {
// refer this - https://chat.openai.com/share/1f7f6ca1-23fb-45c3-9fb1-88c42efb9880
password := []byte(os.Getenv("ENCRYPTION_KEY"))
// pad the plaintext if it is not a muliple of aes.BlockSize
plainTextBytes := []byte(plainText)
padLength := aes.BlockSize - len(plainTextBytes)%aes.BlockSize
padding := bytes.Repeat([]byte{byte(padLength)}, padLength)
plainTextBytes = append(plainTextBytes, padding...)
cipherText := make([]byte, len(plainTextBytes))