Skip to content

Instantly share code, notes, and snippets.

View snapo's full-sized avatar

snapo

View GitHub Profile
@snapo
snapo / block-keyword-ufw.sh
Created June 12, 2024 00:49
ufw block automatic IP's that are infected and create high cpu useage and always request the same wp-json even it dosent exist....
#!/bin/bash
# Path to the access log file
ACCESS_LOG="access.log"
# Path to the file that will store unique IP addresses
IP_LIST="ip_list.txt"
# Function to extract IP addresses and add them to the IP list
extract_ips() {

CadQuery Shape primitives


3d shapes

Box

Workplane.box

result = cq.Workplane("XY" ).box(3, 3, 3)

07

@snapo
snapo / SatDrainageSystem.pn
Created March 8, 2023 16:16
Tradingview Bitcoin price prediction for bottoms and tops, Halfingcycles are considered to exponentially increase the movement of the crossover... Only works on a daily timeframe...
//@version=5
indicator(title="SatDrainageSystem", shorttitle="SDS", overlay=true, timeframe="", timeframe_gaps=true)
x = 117569600000
primedistance = 0.15 / 100
normalclose = close
tsince = timestamp("28 Nov 2012 00:00")
tbarclose = time_close
tdiffms = tsince - tbarclose
fullhalvings = math.floor(tdiffms / x)
@snapo
snapo / FreeCAD headless
Last active September 11, 2022 04:37
FreeCAD headless export files and use in visual studio code directly with python of your choice (Python <=3.8 required)
# The imports of the FreeCAD library
import os
from os.path import exists as file_exists
import sys
FREECADPATH = 'C:/Program Files/FreeCAD 0.19/bin/'
sys.path.append(FREECADPATH)
FREECADPATH = 'C:/Program Files/FreeCAD 0.19/lib/'
sys.path.append(FREECADPATH)
import PySide2
import six
#!/bin/bash
username="xxxx"
password="xxxx"
# Update and get required packages
apt-get update && apt-get -y upgrade
apt-get -y purge
apt-get install -y lftp sshfs
@snapo
snapo / capture.py
Created January 23, 2020 11:57 — forked from jefftriplett/capture.py
Using Python 3, selenium, and headless chrome ala chromedriver to capture website screenshots
"""
To install:
# python requirements
$ pip install click selenium
# for headless chrome
$ brew install chromedriver
To use:
$ python capture.py https://revsys.com revsys.png
@snapo
snapo / btc_max_dd.py
Created January 22, 2020 13:25 — forked from mostlyinteresting/btc_max_dd.py
Rolling n Year Max DD for BTC
import os
import pandas as pd
import datetime as dt
import seaborn as sns
import matplotlib.pyplot as plt
import ccxt
from dateutil import relativedelta
import numpy as np
sns.set(style = 'ticks', context = 'talk')
@snapo
snapo / btc_gold_correlation.py
Created January 22, 2020 13:25 — forked from mostlyinteresting/btc_gold_correlation.py
Rolling 30 day correlation of BTC with gold
import os
import pandas as pd
import datetime as dt
import seaborn as sns
import matplotlib.pyplot as plt
import ccxt
sns.set(style = 'ticks', context = 'talk')
plt.style.use("dark_background")
@snapo
snapo / curve_example.py
Last active January 22, 2020 12:58 — forked from nlitsme/curve_example.py
example of bitcoin curve calculations in python
"""
Example of how calculations on the secp256k1 curve work.
secp256k1 is the name of the elliptic curve used by bitcoin
see http://bitcoin.stackexchange.com/questions/25382
"""
p = 2**256 - 2**32 - 977

Intermediate Python for Finance Training

This is the Gist for Day 1 of the Intermediate Python for Finance Training in London, 28. November 2017

Agenda

Module 1 — Python