Skip to content

Instantly share code, notes, and snippets.

def efficient_hash_df(df, index=True, small_frame_limit=99999, num_chars=10):
'''
Quickly produces a deterministic hash of a dataframe in a nice readable hash format
Larger DataFrames get sampled for efficiency, but this should usually be OK.
'''
if df.shape[0] <= small_frame_limit:
hexdigest = hashlib.sha1(pd.util.hash_pandas_object(df , index=index).values).hexdigest()
else:
@RokoMijic
RokoMijic / umap_stacktrace
Created May 14, 2020 16:34
umap_stacktrace
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<timed exec> in <module>
~/anaconda3/envs/JupyterSystemEnv/lib/python3.6/site-packages/umap/umap_.py in fit(self, X, y)
1935 self.output_metric in ("euclidean", "l2"),
1936 self.random_state is None,
-> 1937 self.verbose,
1938 )[inverse]
1939
Terms and Conditions for Interacting with Roko
A free tier interaction is avaiable for a period of 1 hour.
Thereafter, each hour of interaction is billed at $50/hour.
These Terms will be governed by and interpreted in accordance with US laws, and you submit to the non-exclusive jurisdiction of the state and federal courts located in the US for the resolution of any disputes.
--v function(ax: number, ay: number, bx: number, by: number) --> number
local function distance_2D(ax, ay, bx, by)
return (((bx - ax) ^ 2 + (by - ay) ^ 2) ^ 0.5);
end;
local leave_alive = {
--- PLAYABLE FACTIONS ---
--Bretonnians
--"wh_main_brt_bretonnia",
Traceback (most recent call last):
File "//REDACTED//source/main/mad_scoreorfilter_sourcetarget_CL.py", line 3, in <module>
import mad_score_sourcetarget_systran
File "//REDACTED//madenv35/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "//REDACTED//source/main/mad_score_sourcetarget_systran.py", line 14, in <module>
from mad_scoreorfilter_entrans import create_outputs
File "//REDACTED//madenv35/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "//REDACTED//source/main/mad_scoreorfilter_entrans.py", line 4, in <module>
@RokoMijic
RokoMijic / gist:8411c4a8ccc1356199b6cf3f68f5bb86
Created March 16, 2017 12:06
Stacktrace for zeep error "assert name AssertionError line 116"
/home/r/Git/PycharmProjects/euroscraper/eusc_env/bin/python3.5 /home/r/Git/PycharmProjects/euroscraper/src/main/euroscraper/soapr.py
zeep.transports: HTTP Post to http://eur-lex.europa.eu/EURLexWebService:
<?xml version='1.0' encoding='utf-8'?>
<soap-env:Envelope xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope">
<soap-env:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>REDACTED</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">REDACTED</wsse:Password>
</wsse:UsernameToken>
@RokoMijic
RokoMijic / soapr.py
Created March 16, 2017 12:03
Example zeep script to reproduce "assert name AssertionError line 116"
from zeep import Client
from zeep.wsse.username import UsernameToken
import logging.config
client = Client("http://eur-lex.europa.eu/eurlex-ws?wsdl", wsse=UsernameToken( 'INSERT_USERNAME' , 'INSERT_PASSWORD' ) )
result = client.service.doQuery(expertQuery='SELECT DN WHERE DN=6*', page=1, pageSize=1, searchLanguage='en')
print(result)