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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import gzip | |
import re | |
import json | |
import argparse | |
import code | |
import copy | |
from jsondiff import diff |
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
<meta content="width=device-width,initial-scale=1" name="viewport" /> | |
<section class="container" id="Relevancy"> | |
<div class="row"> | |
<div class="col-xs-12 col-md-12"> | |
<div class="panel panel-primary"><a class="panel-heading" href="javascript:void(0);" id="collapseTrigger"><strong>Tagging Instructions</strong> <span class="collapse-text">(Click to expand)</span> </a> | |
<div class="panel-body" id="instructionBody"><strong>Tag the description to extract the following fields of interest</strong> | |
<table class="table table-condensed table-striped table-responsive"> | |
<colgroup> | |
<col class="col-xs-2 col-md-2" /> | |
<col class="col-xs-10 col-md-10" /> |
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
def binary_focal_loss_with_logits(input, target, gamma, reduction="mean"): | |
t = target.float() | |
p = torch.clamp((2 * t - 1) * torch.sigmoid(input) + (1 - t), min=1e-20) | |
loss = - ( 1 - p) ** gamma * p.log() | |
if reduction == "none": | |
return loss | |
elif reduction == "mean": | |
return loss.mean() | |
elif reduction == "sum": | |
return loss.sum() |
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
" Slime | |
let g:slime_target = "tmux" | |
let g:slime_default_config = {"socket_name": "default", "target_pane": "code:.0"} | |
let g:slime_dont_ask_default = 1 | |
let g:slime_python_ipython = 1 | |
let g:slime_preserve_curpos = 0 | |
nmap <leader>v <Plug>SlimeConfig | |
"In visual mode, send selection |
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 fire import Fire | |
def bookmarks_to_links(html): | |
soup = BeautifulSoup(html, 'lxml') | |
links = [x.attrs['href'] for x in soup.findAll('a')] | |
return links | |
def links_to_bookmarks(links): |
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 requests | |
import base64 | |
import json | |
SECRET = 12345678 # DO NOT SHARE | |
def send(t): | |
content = [[0,"e4",{"f":"j","t": t}]] | |
c = base64.b64encode(json.dumps(content).encode()).decode() | |
payload = {'s': SECRET, 'c': c} |