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
@NISH1001
NISH1001 / paradoxicalencoder.py
Last active February 1, 2018 11:37
paradoxicalencoder.py
class ParadoxicalEncoder:
def __init__(self):
self.classes = set()
self.encodings = {}
def _updte_encodings(self, label):
try:
enc = self.encodings[label]
except KeyError:
self.encodings[label] = len(self.encodings)+1
@NISH1001
NISH1001 / gwget
Created February 5, 2018 10:26
wget file from google drive
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILE_ID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILE_ID" -O FILENAME && rm -rf /tmp/cookies.txt
@NISH1001
NISH1001 / api.py
Last active February 13, 2018 09:57
api
"""
Required modules/libraries:
- falcon
- falcon-cors
- falcon-multipart
- gunicorn
TO run the api:
gunicorn -b ip:port api:app
@NISH1001
NISH1001 / create_dataset.py
Created February 16, 2018 15:13
create dataset
import os
import cv2
from shutil import copyfile
from random import randint,shuffle
import string
def create_dir(path):
if not os.path.exists(path):
os.makedirs(path)
@NISH1001
NISH1001 / determinant.c
Created March 10, 2018 14:56
Find determinant of a NxN matrix (square matrix)
#include <stdio.h>
#include <stdlib.h>
/* 1 2 3 5
3 4 5 6
6 7 8 7
2 3 4 5
*/
int deterstandard(const int order,int **matrix)
{
int i,j,k,val=0;
@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
@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 / 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 / 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.
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