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
class Printer: | |
def __init__(self): | |
self.log = '' | |
def __repr__(self): | |
return self.log | |
def __call__(self, *args, **kwargs): | |
self.log += str(args) + '\n' | |
__builtins__.print(*args, **kwargs) | |
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
typeperf.exe -sc 1 "\Processor Information(_Total)\Processor Frequency" | |
REM "(PDH-CSV 4.0)","\\DELL_DE_VADIM\Processor Information(_Total)\Processor Frequency" | |
REM "08/09/2023 13:43:32.695","1358.000000" | |
typeperf.exe -qx | findstr.exe Frequency | |
REM \Windows Time Service\Clock Frequency Adjustment (PPB) | |
REM \Windows Time Service\Clock Frequency Adjustment | |
REM \Processor Information(0,0)\% of Maximum Frequency | |
REM \Processor Information(0,1)\% of Maximum Frequency | |
REM \Processor Information(0,2)\% of Maximum Frequency |
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 torch | |
def dist(histA, histB): | |
# this min-sum histogram distance is used in Selective SehistArch histAt https://ivi.fnwi.uvhistA.nl/isis/puhistBlichistAtions/2013/UijlingsIJCV2013 | |
return torch.min(histA / histA.sum(dim = -1, keepdim = True), histB / histB.sum(dim = -1, keepdim = True)).sum(dim = -1) | |
def merge(histA, multA, histB, multB): | |
hist_int32 = histA * multA + histB * multB | |
mult_int32 = hist_int32.amax(dim = -1, keepdim = True).div_(255, rounding_mode = 'floor').add_(1) # need to round up or down? |
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
namespace CSharpFromPythonNamespace | |
{ | |
public class CSharpFromPythonClass | |
{ | |
public string Hi(string x) | |
{ | |
return "Hi " + x; | |
} | |
public static string Hello(string x) |
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
<!DOCTYPE html><html charset="utf-8" lang="en"><head><meta http-equiv="refresh" content="0; url=https://path.to/my/url"><title>This Is My Title</title></head></html> |
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 https://github.com/stas00/toolbox/blob/master/pytorch/all_reduce_bench.py | |
def printflock(*msgs): | |
""" print """ | |
with open(__file__, "r") as fh: | |
fcntl.flock(fh, fcntl.LOCK_EX) | |
try: | |
print(*msgs) | |
finally: | |
fcntl.flock(fh, fcntl.LOCK_UN) |
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
This Upwork bug has been present for years and Upwork does nothing to fix it or even investigate it: | |
- https://community.upwork.com/t5/Freelancers/I-can-t-log-in-ERR-TOO-MANY-REDIRECTS/m-p/710733 | |
- https://community.upwork.com/t5/Support-Forum/Invited-colleague-cannot-log-in-to-Upwork/td-p/1154335 | |
In this situation, you cannot log in, and thus cannot even create a normal support ticket. | |
It seems that the problem appears because Upwork put account-> company association in an invalid state, | |
and thus something blows up when Upwork tries to fetch the account's company information during login. | |
I found a few ways to reach Upwork's Support even if you cannot log in: | |
- Create a support ticket about account/password recovery: https://support.upwork.com/hc/en-us/requests/new?ticket_form_id=360000464433 |
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
# https://sitemaps.org/protocol.html | |
import sys | |
import xml.dom.minidom | |
import urllib.request | |
def sitemapindex_urlset_concat(url): | |
sitemapindex = xml.dom.minidom.parse(urllib.request.urlopen(url)) | |
for sitemap in sitemapindex.getElementsByTagName('sitemap'): | |
urlset = xml.dom.minidom.parse(urllib.request.urlopen(sitemap.getElementsByTagName('loc')[0].firstChild.nodeValue)) |
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
class ConfigProxy: | |
def __init__(self, cfgobj = None, ConfigProxyPath = '', ConfigProxyRoot = '', ConfigProxySep = '__', **cfgdict): | |
self.cfgobj = cfgobj | |
self.cfgdict = cfgdict | |
self.ConfigProxyRoot = ConfigProxyRoot | |
self.ConfigProxyPath = ConfigProxyPath | |
self.ConfigProxySep = ConfigProxySep | |
def __getattr__(self, key): | |
ConfigProxyPath = self.ConfigProxyPath + self.ConfigProxySep + key if self.ConfigProxyPath else key |
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
diff --new-line-format="" --unchanged-line-format="" <(tail -n +2 all.csv | cut -d',' -f6 | tr -d '"' | sort -u) <( tail -n +2 sent.csv | cut -d',' -f1 | tr -d '"' | sort -u) |