Skip to content

Instantly share code, notes, and snippets.

View alecthegeek's full-sized avatar
🤖
Dem keyboards don't go click click on their own you know

Alec Clews alecthegeek

🤖
Dem keyboards don't go click click on their own you know
View GitHub Profile
@alecthegeek
alecthegeek / .gitconfig
Last active August 23, 2020 07:19
Git alias for next `git next` to go to next commit. Works on Powershell
# Git alias for next `git next` to go to next commit. Works on Powershell, brobably works on Bash as well.
# Useful for live code demo. See https://blog.jayway.com/2015/03/30/using-git-commits-to-drive-a-live-coding-session
# Info about mapfile from https://www.computerhope.com/unix/bash/mapfile.htm
# Needed because Git on Windows does not have access to tail (by default)
next = "!$SHELL -c 'git checkout $(mapfile -t < <(git rev-list HEAD..demo-end);echo -n ${MAPFILE[-1]})'"
#!/usr/bin/env python
# Find cube roots. In honour of Pandrosion of Alexandria on Ada Lovelace day 2020
# from https://en.wikipedia.org/wiki/Cube_root#Numerical_methods
# see also https://docs.python.org/3/tutorial/floatingpoint.html
def cubeRoot(a, epislon = 0.001):
''' Approximate cube roots using Halley's method
@alecthegeek
alecthegeek / gcloud.sh
Created June 1, 2021 22:25
Bash alias to run Google gcloud via Docker
# Bash alias to run Google gcloud via Docker
alias gcloud="docker run --workdir=/home/cloudsdk/work --user cloudsdk:cloudsdk \
--mount type=bind,source=$PWD,target=/home/cloudsdk/work \
--mount type=volume,source=gcloud_config,target=/home/cloudsdk/.config \
--rm -ti gcr.io/google.com/cloudsdktool/cloud-sdk:slim gcloud"
@alecthegeek
alecthegeek / keybase.md
Last active April 19, 2024 06:53
keybase.md

Keybase proof

I hereby claim:

  • I am alecthegeek on github.
  • I am alecthegeek (https://keybase.io/alecthegeek) on keybase.
  • I have a public key ASBFcJ6GvWTlzfOjNNAe7KUFVzmpTpq32EoKJvPjwkycvQo

To claim this, I am signing this object: