Skip to content

Instantly share code, notes, and snippets.

View le-dawg's full-sized avatar
👁️
I may be slow to respond.

dawg le-dawg

👁️
I may be slow to respond.
View GitHub Profile
@le-dawg
le-dawg / PandasSnippets.py
Created June 25, 2017 21:09
Python / Pandas snippets for the troubleshooting developer pt.1
  #Count occurences of string in dataframe
  #Check how many rows in DataFrame contain certain substring s in column col
print(len(df[df['col'].str.contains("s")].index.values[:]))
 
#Index of columns in dataframe containing string
#Get indices of rows that contain substring s in column col
print(df[df['col'].str.contains("s")].index.values[:])
@le-dawg
le-dawg / init2dlist.py
Created June 25, 2017 21:13
Easily initialize 2D list
    # Rapidly initalize 2D list
2dlist = [[0] * 3 for i in xrange(3)]
print(2dlist)
# [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
@le-dawg
le-dawg / gist:7adce5a18ae31dcd057da4f5c7c750cc
Created February 13, 2018 18:07
[Wordpress, X Theme, Cornerstone] Close Accordion Element on load
//This snippet is a very short jQuery function that is executed when the javascript is exectued on load.
// Troubleshooting:
// You might want to add a specific class to the accordion element itself and then append that to the first div: ('div#accordionID > ...
jQuery(function(){
jQuery('div > div.x-accordion-heading > a.x-accordion-toggle').click();
});
@le-dawg
le-dawg / greplacer.sh
Created November 21, 2018 02:28
Replace strings in a fodler structure recursivelz while protecting files/folders
grep -rlI git: . --exclude-dir={.git,.circleci,.gitattributes,.gitignore,.editorconfig} | xargs sed -i 's/git:/https:/g'
@le-dawg
le-dawg / multi_gpu_log
Created November 30, 2018 04:34
multi gpu mining log
2018-11-30 05:31:50.350 [info] <0.13017.0>@aec_pow_cuckoo:generate_int_:214 Executing cmd: "./cuda29 -h 70684B536E66476C35763739436C67506E536E30517A4572694679354553722B367445573178497555796B3D71443150754864755743593D -d 0"
2018-11-30 05:31:50.350 [info] <0.13018.0>@aec_pow_cuckoo:generate_int_:214 Executing cmd: "./cuda29 -h 70684B536E66476C35763739436C67506E536E30517A4572694679354553722B367445573178497555796B3D71443150754864755743593D -d 1"
2018-11-30 05:31:50.351 [info] <0.13019.0>@aec_pow_cuckoo:generate_int_:214 Executing cmd: "./cuda29 -h 70684B536E66476C35763739436C67506E536E30517A4572694679354553722B367445573178497555796B3D71443150754864755743593D -d 2"
2018-11-30 05:31:51.392 [debug] <0.13017.0>@aec_pow_cuckoo:parse_generation_result:479 GeForce GTX 1070 with 8118MB @ 256 bits x 4004MHz
2018-11-30 05:31:51.392 [debug] <0.13017.0>@aec_pow_cuckoo:parse_generation_result:479 Looking for 42-cycle on cuckoo30("phKSnfGl5v79ClgPnSn0QzEriFy5ESr+6tEW1xIuUyk=qD1PuHduWCY=",0) with 50% edges, 64*64 buckets, 17

Keybase proof

I hereby claim:

  • I am le-dawg on github.
  • I am truedawg (https://keybase.io/truedawg) on keybase.
  • I have a public key ASCRWLIs65PdPP1f0Skwx0FVzT_-sPXO_srKeI-zndncjAo

To claim this, I am signing this object:

@le-dawg
le-dawg / pyplot_heatmap_fix_clipping
Created February 8, 2020 22:44
Fix for Pyplot/Matlplotlib heatmap clipping
# fix for mpl bug that cuts off/clips/clipping top/bottom of seaborn viz
b, t = plt.ylim() # discover the values for bottom and top
b += 0.5 # Add 0.5 to the bottom
t -= 0.5 # Subtract 0.5 from the top
plt.ylim(b, t) # update the ylim(bottom, top) values
plt.show() # ta-da!
# https://github.com/mwaskom/seaborn/issues/1773
@le-dawg
le-dawg / TFdataset_HAR_snn.ipynb
Created February 27, 2020 16:30
Time Series input function for tensorflow estimator
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@le-dawg
le-dawg / awsmining.md
Created December 29, 2020 15:20
XMR Mining AWS ... here is how to do it securely

So you want to mine in AWS without getting caught

tl;dr: AWS mining is against TOC so even if you have credits you will be invoiced and your credits burned. Watch out. These methods only help mitigate or lower the risk of discovery. Share responsibly.

Problem

AWS is firewalled af on top of the policy mentioned in tl;dr. A good way is to use a mining proxy with TLS. Even better would be a point-to-point VPN. Using VPN directly is also a good solution - but services that let you configure that you only want one certain port to run via VPN and not the SSH connection that is your lifeline are costly. This document sketches a few solutions, provides some links, and documents one particular approach. And remember, methods of detection will soon encompass deep learning: https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9178288

@le-dawg
le-dawg / gist:b3e1f1b8a1f06a27f353090e75d86d6a
Created July 5, 2021 09:13
Prep new environment for cadCAD simulation (Windows, Anaconda)
conda create -n NAME python=3.7.5
conda activate NAME
conda install -c conda-forge pandas logging networkx matplotlib cadcad scipy numpy seaborn