Skip to content

Instantly share code, notes, and snippets.

View tejas-kr's full-sized avatar
🐢
Learning slowly but thoroughly now !

Tejas Kumar Jaiswal tejas-kr

🐢
Learning slowly but thoroughly now !
  • /home/tejas
View GitHub Profile
@tejas-kr
tejas-kr / hashing_passwords.py
Created March 12, 2024 14:35
Snippet to hash passwords
import hashlib
hashed_str1 = hashlib.sha256('text123hello'.encode('utf-8')).hexdigest()
print(hashed_str1)
hashed_str2 = hashlib.sha256('text123hello'.encode('utf-8')).hexdigest()
print(hashed_str2)
assert hashed_str1 == hashed_str2
@tejas-kr
tejas-kr / gen_random_str.py
Created March 12, 2024 06:48
Generate Random String (of random characters) Python
import random
import string
letters = []
letters.extend(string.ascii_lowercase)
letters.extend(string.ascii_uppercase)
letters.extend((str(i) for i in range(0, 10)))
print(letters)
print(''.join([random.choice(letters) for i in range(50)]))
@tejas-kr
tejas-kr / flask_db_conn_manager.py
Created March 6, 2024 17:14
Flask DB Connection Manager Script
from flask import g, current_app
from db import DB
def get_db():
if 'db' not in g:
g.db = DB()
return g.db
@tejas-kr
tejas-kr / text_processing.py
Created April 23, 2021 05:05
text processing for nlp tasks (using nltk) [for spacy i will create soon]
from nltk.corpus import stopwords
import string
def text_process(text):
nopunc = [char for char in text if char not in string.punctuation]
nopunc = ''.join(nopunc)
return [word for word in nopunc.split() if word.lower() not in stopwords.words('english')]
@tejas-kr
tejas-kr / check_jquery_load.js
Last active April 23, 2021 04:40
Javascript code to check if jquery is loaded in the page
/**
* This code is very helpful for people who forget things easily
*/
window.onload = function() {
if (window.jQuery) {
alert('jQuery loaded!');
} else {
alert('jQuery not loaded!');
}
{
'jquery file upload' : 'https://blueimp.github.io/jQuery-File-Upload/index.html'
}
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="1526886570" LAST_MODIFIED="1528349593" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@tejas-kr
tejas-kr / typing_and_floating_text.js
Created April 21, 2018 06:05
javascript animation to make a typing text effect and a floating text effect.
// keep the code neat...
(function() {
var i = 0;
var txt = 'Tejas Jaiswal'; /* The text */
var speed = 200; /* The speed/duration of the effect in milliseconds */
function typeWriter() {
// console.log('teff');
if (i < txt.length) {
document.getElementById("demo12").innerHTML += txt.charAt(i);
i++;
@tejas-kr
tejas-kr / revision.java
Created March 13, 2018 05:34 — forked from danielpaul/revision.java
Basic Java Revision Notes - Written in Java
/*
*
* / --------------------------------[ NUIM CS141 Java Revision ]------------------------------- \
* || Designed to easily revise everything covered in CS141 by just reading through this code. ||
* || Comments accompany almost every line of code to explain its purpose. ||
* || Some theory we need to know are included in the bottom... ||
* \ ------------------------------------------------------------------------------------------- /
*
*
* ____ _ __ ____ __
# Command line based image viewer
# made purely with python 2.7
from PIL import Image
from sys import argv
img = Image.open(argv[1])
img.show()
# Wondoers in Just 4 lines of code.