Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Rafay AbdulRafay

🎯
Focusing
View GitHub Profile
View colabssh
import random, string, urllib.request, json, getpass
#Generate root password
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
View hadoopcleanup
ambari-server stop
ambari-agent stop
pkill -9 java
#################################
# Remove Packages
################################
yum -y remove ambari-\*
yum -y remove hcatalog\*
yum -y remove hive\*
View bert.py
import torch
import warnings
from pathlib import Path
from argparse import ArgumentParser
from pybert.train.losses import BCEWithLogLoss
from pybert.train.trainer import Trainer
from torch.utils.data import DataLoader
from pybert.io.bert_processor import BertProcessor
from pybert.common.tools import init_logger, logger
from pybert.common.tools import seed_everything
View post_pred.py
import requests
import json
# defining the api-endpoint
API_ENDPOINT = "https://entke6c4912e.x.pipedream.net"
predi = "{'data': 'awesome predication'}"
# data to be sent to api
data = json.dumps(predi)
@AbdulRafay
AbdulRafay / hiddenmojo
Last active Jan 28, 2020
gather table cell values in last cell's form hidden field
View hiddenmojo
jQuery('tr', jQuery(".ht-table").first().find('tbody')).each(function(i,j){
var last=jQuery(j).children().last().get(0);
var form=jQuery(last).find("form");
let l=jQuery("th,td",j);
var temp="<h3>"+jQuery(j).closest("div.single_toggle").find('p.toggler').text()+"</h3>";
jQuery(l).each((a,b)=>{
if(jQuery(b).children().length == 0){
temp += "<p>"+jQuery(j).closest("table").find("thead>tr>th:eq("+a+")").text()+": "+jQuery(b).text()+"</p></br>";
}
});