Skip to content

Instantly share code, notes, and snippets.

View flipdazed's full-sized avatar

Alexander McFarlane flipdazed

View GitHub Profile
@flipdazed
flipdazed / create-branch-protection-rule.sh
Last active March 26, 2023 07:29
Create Branch Protection with GitHub API
#!/bin/bash
set -ue
err() { echo 1>&2 "$*"; }
die() { err "ERROR: $*"; exit 1; }
mustBool() {
[[ "${1#*=}" = "true" || "${1#*=}" = "false" ]] ||
die "bad boolean property value: $1"
}
mustInt() {
[[ "${1#*=}" =~ [0-9]+ ]] ||
@flipdazed
flipdazed / grab_contacts_from_telegram.py
Created November 14, 2022 01:33
Grab all contacts from Telegram
"""
Expects a config file containing the app data from https://my.telegram.org/apps
to be saved at ``'~/.telegram/conf.yaml'``
```yaml
cgrab:
id: <yourId>
hash: <yourHash>
servers:
test:
import os
import time
import numpy as np
import re
import unicodedata
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@flipdazed
flipdazed / secp256k1_malleable.py
Last active September 6, 2022 00:12
Demonstrates why you can get a malleable ECDSA (secp256k1) signature in Python
"""
This code is adapted from one of Vitalik's earliest implementations of Ethereum,
written in python surprisingly. It helps demonstrate the process behind ECDSA
"""
import numpy as np
import hashlib, hmac
import sys
if sys.version[0] == '2':
safe_ord = ord
else:
@flipdazed
flipdazed / Export-ExcelProject.ps1
Created September 26, 2019 18:21 — forked from atifaziz/Export-ExcelProject.ps1
PowerShell script to export VBA project components (classes, modules, etc.) from an Excel workbook
# Copyright (c) 2014 Atif Aziz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@flipdazed
flipdazed / almgren_chriss.py
Created April 30, 2019 22:41
Linear Almgren-Chriss python model
import numba as nb
import numpy as np
def impact_perm(nu, gamma, beta):
"""Returns the permenant dollar price impact per unit time
In paper as :math:`g(\nu)`
Args: