Skip to content

Instantly share code, notes, and snippets.

View shantanuo's full-sized avatar

Shantanu Oak shantanuo

  • oksoft
  • mumbai
View GitHub Profile
@NewscatcherAPI
NewscatcherAPI / all_summary.py
Last active December 30, 2021 09:55
spacy_vs_nltk_newscatcher_blog
summary = [article['summary'] for article in articles]
sentence = summary[0]
import logging
import base64
import boto3
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
s3_client = boto3.client('s3')
@aquilax
aquilax / index.html
Created May 15, 2021 14:19
Sort textarea unique
<a href="javascript:(function(){Array.from(document.querySelectorAll('textarea')).map(function(b){var a=document.createElement('div');var d=document.createElement('button');d.textContent='↑';d.addEventListener('click',function(f){f.preventDefault();b.value=Array.from(new Set(b.value.split('\n'))).sort().join('\n')});var c=document.createElement('button');c.textContent='↓';c.addEventListener('click',function(f){f.preventDefault();b.value=Array.from(new Set(b.value.split('\n'))).sort().reverse().join('\n')});a.appendChild(d);a.appendChild(c);b.parentNode.insertBefore(a,b)})})();">Sort textarea unique</a>
@aquilax
aquilax / index.html
Created May 15, 2021 13:47
Textarea sorting bookmarklet
<a href="javascript:(function(){Array.from(document.querySelectorAll('textarea')).map(function(b){var a=document.createElement('div');var d=document.createElement('button');d.textContent='↑';d.addEventListener('click',function(f){f.preventDefault();b.value=b.value.split('\n').sort().join('\n')});var c=document.createElement('button');c.textContent='↓';c.addEventListener('click',function(f){f.preventDefault();b.value=b.value.split('\n').sort().reverse().join('\n')});a.appendChild(d);a.appendChild(c);b.parentNode.insertBefore(a,b)})})();">Sort textareas</a>
@aquilax
aquilax / bookmarklet_raw.js
Last active May 15, 2021 08:49
Sort lines bookmarklet
javascript:(function(){
var container = document.createElement('div');
container.setAttribute('style', 'position: absolute; top: 0; right: 0; left: 0; bottom: 0; z-index: 9999');
var textarea = document.createElement('textarea');
textarea.setAttribute('style', 'width:99%; height: 20em');
var close = document.createElement('button');
close.textContent = 'Close'
close.addEventListener("click", function() {
import pandas as pd
df = pd.read_csv('en_bigram.csv')
st = df[df["right"] == "some_text"]["left"]
st[st.str.startswith("My")].to_list()
# using a dict reader
import csv
result = []
with open("en_bigram.csv") as f:
@ameerkat
ameerkat / worldnews_fastai_classifier.ipynb
Last active April 10, 2021 17:16
fast.ai example notebook for training a classifier on reddit
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MineRobber9000
MineRobber9000 / donotuse3.py
Last active February 8, 2024 12:48
How to NEVER use lambdas - Python 3 edition
###########################################################
# How to NEVER use lambdas. An inneficient and yet educa- #
# tonal [sic] guide to the proper misuse of the lambda #
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] #
# original by (and apologies to): e000 (13/6/11) #
# now in Python 3 courtesy of: khuxkm (17/9/20) #
###########################################################
## Part 1. Basic LAMBDA Introduction ##
# If you're reading this, you've probably already read e000's
@davidkyle
davidkyle / README.md
Last active December 12, 2020 09:50
Aggregations and Visualisations supporting the Inference Pipeline Agg blog

Getting started with the Inference Aggregation

First ingest the customer churn data and trained model

Ingest the linked csv files above into Elastic using the Kibana Data Visualizer. You will find the Data Visualizer in the Machine Learning section. Ingest into the indices calls and customers.

@miladfa7
miladfa7 / gpt2_from_scratch.py
Last active April 30, 2023 06:54
Train GPT-2 from Scratch on your own language(Persain) | GPT-2 Training on non-english text
from simpletransformers.language_modeling import LanguageModelingModel
import logging
logging.basicConfig(level=logging.INFO)
transformers_logger = logging.getLogger("transformers")
transformers_logger.setLevel(logging.WARNING)
train_args = {