Skip to content

Instantly share code, notes, and snippets.

View NISH1001's full-sized avatar
💭
Staring into the abyss...

Nish NISH1001

💭
Staring into the abyss...
View GitHub Profile

create new session

tmux new -s session_name

attach to existing session

tmux a -t session_name

kill session

tmux kill-session -t session_name

Note : Do not do

a simple text file with timestamp

vim +'r!date' ~/did.txt

a simple text file with timestamp and automatic insert mode at the end of the file

vim +'normal Go' +'r!date' ~/did.txt

Finally! Create alias

alias did="vim +'normal Go' +'r!date' ~/did.txt"

-c("Concurrency")

Indicates how many clients (people/users) will be hitting the site at the same time. While ab runs, there will be -c clients hitting the site. This is what actually decides the amount of stress your site will suffer during the benchmark.

-n

Indicates how many requests are going to be made. This just decides the length of the benchmark. A high -n value with a -c value that your server can support is a good idea to ensure that things don't break under sustained stress: it's not the same to support stress for 5 seconds than for 5 hours.

-k

This does the "KeepAlive" funcionality browsers do by nature. You don't need to pass a value for -k as it it "boolean" (meaning: it indicates that you desire for your test to use the Keep Alive header from HTTP and sustain the connection). Since browsers do this and you're likely to want to simulate the stress and flow that your site will have from browsers, it is recommended you do a benchmark with this.

We can't make this file beautiful and searchable because it's too large.
#AUTHID,text,ext,neu,agr,con,opn
1997_504851.txt,"Well, right now I just woke up from a mid-day nap. It's sort of weird, but ever since I moved to Texas, I have had problems concentrating on things. I remember starting my homework in 10th grade as soon as the clock struck 4 and not stopping until it was done. Of course it was easier, but I still did it. But when I moved here, the homework got a little more challenging and there was a lot more busy work, and so I decided not to spend hours doing it, and just getting by. But the thing was that I always paid attention in class and just plain out knew the stuff, and now that I look back, if I had really worked hard and stayed on track the last two years without getting lazy, I would have been a genius, but hey, that's all good. It's too late to correct the past, but I don't really know how to stay focused n the future. The one thing I know is that when people say that b/c they live on campus they can't concentrate, it's b. s. For me it would be easier there, b
@NISH1001
NISH1001 / han.py
Last active September 6, 2018 06:49
## model creation on Keras
from keras.models import Model
from keras.layers import Input, Merge, Layer
from keras.layers import Dense, Dropout
from keras.layers import Embedding
from keras.layers import LSTM, GRU, Conv1D, MaxPooling1D, Bidirectional, Concatenate, TimeDistributed, Masking, Lambda
from keras import backend as K
from keras import initializers as initializations
We can't make this file beautiful and searchable because it's too large.
text,opn,con,ext,agr,neu
likes the sound of thunder.,1,0,0,0,1
is so sleepy it's not even funny that's she can't get to sleep.,1,0,0,0,1
"is sore and wants the knot of muscles at the base of her neck to stop hurting. On the other hand, YAY I'M IN ILLINOIS! <3",1,0,0,0,1
likes how the day sounds in this new song.,1,0,0,0,1
is home. <3,1,0,0,0,1
www.thejokerblogs.com,1,0,0,0,1
"saw a nun zombie, and liked it. Also, *PROPNAME* + Tentacle!Man + Psychic Powers = GREAT Party.",1,0,0,0,1
is in Kentucky. 421 miles into her 1100 mile journey home.,1,0,0,0,1
was about to finish a digital painting before her tablet went haywire. Is now contemplating the many ways she wishes to exact her revenge on faulty technology.,1,0,0,0,1
@NISH1001
NISH1001 / colab-google-auth.py
Created June 28, 2018 09:19
Downlaod/Upload files from/to google drive in google colab
# Install the PyDrive wrapper & import libraries.
# This only needs to be done once in a notebook.
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
# This only needs to be done once in a notebook.
@NISH1001
NISH1001 / instachecker.py
Created April 9, 2018 16:52
A naive script to check if a username is available in Instagram
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
def check_user(username):
url = "https://www.instagram.com/{}".format(username)
response = requests.get(url)
status_code = response.status_code
@NISH1001
NISH1001 / stringenc.py
Last active April 4, 2018 09:57
embed hidden messages into standard text/string using zero width characters
ZERO_WIDTH_JOINER = '\u200d'
ZERO_WIDTH_SPACE = '\u200b'
ZERO_WIDTH_NON_JOINER = '\u200c'
ZERO_WIDTH_NO_BREAK_SPACE = '\ufeff'
def zeropad(num, padding=8):
return str(num).zfill(padding)
def num_to_binary(num):
return bin(num)[2:]
@NISH1001
NISH1001 / abstract.py
Created March 20, 2018 09:54
abstract class in python
#!/usr/bin/env python3
from abc import ABC, abstractmethod
class Base(ABC):
def __init__(self, val):
super().__init__()
self.val = val
@abstractmethod