Skip to content

Instantly share code, notes, and snippets.

@smrati
smrati / wordle_helper.py
Created January 30, 2022 08:41
wordle solver: brute force
class wordle:
def __init__(self, input_data_path):
self.input_data_path = input_data_path
def get_path(self):
print(self.input_data_path)
def get_words_by_len(self, word_length):
"""
filter words of specific length
@smrati
smrati / multiple_ssh_setting.md
Created August 9, 2020 19:08 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@smrati
smrati / brix.py
Created July 19, 2020 10:24 — forked from neilslater/brix.py
Keras example image regression, extract texture height param
# -*- coding: utf-8 -*-
import numpy as np
import os
import cv2
import pandas as pd
from sklearn.cross_validation import train_test_split
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D
import numpy as np
from keras import backend as K
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.preprocessing.image import ImageDataGenerator
from sklearn.metrics import classification_report, confusion_matrix
#Start
train_data_path = 'F://data//Train'
@smrati
smrati / tutorial_1.py
Created January 25, 2020 07:34
MechanicalSoup Basic Tutorial
import mechanicalsoup
user_agent_string = 'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36'
browser = mechanicalsoup.StatefulBrowser(user_agent=user_agent_string, )
browser.open('https://ebootcamp.dev')
headings_list = browser.get_current_page().find_all('h3')
for heading in headings_list:
print(heading.text)
@smrati
smrati / big_o.md
Created November 8, 2019 12:38
Big O

Big O Notation

Let say you have a coding problem in hand and you can think of two different ways to solve (code) that problem. You want to identify which way is better. To do this comparison what we will do is to calculate Big O of both of these methods and compare them.
So in a sense Big O is a way to measure the resource requirements for different methods.
Resource could be

  1. Time resource => How much time our code takes to complete
  2. Space resource => How much memory our code need to complete

python manage.py collectstatic --no-input
@smrati
smrati / gist:0b6044322fad13f2248d87916504efab
Created November 16, 2018 17:10
How to delete a remote branch from local without deleting it from remote repo
git branch -d -r origin/mohit
@smrati
smrati / smart_string.py
Created October 4, 2018 05:17
Django smart string
from django.utils.encoding import smart_str, smart_unicode
a = u'\xa1'
print smart_str(a)
@smrati
smrati / test.sh
Created September 25, 2018 07:38
Add all files in Git with a given name pattern
find . -name '*.java' | xargs git add