This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func printJson(data interface{}) { | |
bs, err := json.MarshalIndent(data, "", " ") | |
if err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you need this in your cargo.toml | |
// reqwest = { version = "0.11.3", features = ["stream"] } | |
// futures-util = "0.3.14" | |
// indicatif = "0.15.0" | |
use std::cmp::min; | |
use std::fs::File; | |
use std::io::Write; | |
use reqwest::Client; | |
use indicatif::{ProgressBar, ProgressStyle}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function notify_when_online(){ | |
host=$1 | |
while true; do | |
ping -c1 $host > /dev/null && break; | |
done && notify-send --icon=dialog-information "$host is online" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .download import download | |
from bs4 import BeautifulSoup | |
import json | |
import re | |
import requests | |
import sys | |
if sys.version_info.major < 3: | |
from pathlib2 import Path | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from bs4 import BeautifulSoup | |
import requests | |
import gdown | |
import json | |
import argparse | |
parser=argparse.ArgumentParser() | |
parser.add_argument("url") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
from selenium import webdriver | |
import gdown | |
import argparse | |
parser=argparse.ArgumentParser() | |
parser.add_argument("url") | |
args=parser.parse_args() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
from contextlib import contextmanager | |
class TimeOutError(RuntimeError):pass | |
@contextmanager | |
def timeout(duration): | |
def timeout_handler(signum, frame): | |
raise TimeOutError() | |
signal.signal(signal.SIGALRM, timeout_handler) | |
signal.alarm(duration) | |
try: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import StringIO | |
from random import gauss,randrange | |
max_chars=63206 #https://sproutsocial.com/insights/social-media-character-counter/ | |
wrong="9" | |
right="6" | |
f=StringIO() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import make_blobs | |
# import pandas as pd | |
import numpy as np | |
centers=[ | |
[.1,.1], | |
[.2,.1], | |
[.3,.1], | |
[.4,.1], | |
[.5,.1], |