Skip to content

Instantly share code, notes, and snippets.

View matthewbadeau's full-sized avatar

Matthew matthewbadeau

  • Osaka, Japan
View GitHub Profile
@matthewbadeau
matthewbadeau / install_packages
Last active January 11, 2019 08:35 — forked from luiscape/install_packages.sh
Install Python dependency packages from requirements.txt using conda.
# New version for Windows
# Forked from https://gist.github.com/luiscape/19d2d73a8c7b59411a2fb73a697f5ed4
#
#
# Install using pip
#
for /f %i in (requirements.txt) do python -m pip install %i
@matthewbadeau
matthewbadeau / downloader.ps1
Created May 29, 2018 13:48
Humble Book Bundle Downloader - Powershell version
$client = New-Object System.New.WebClient
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
$client.DownloadFile("https://dl.humble.com/filename.pdf?gamekey=asdfasdf","<filename.pdf>")
....
@matthewbadeau
matthewbadeau / day1.py
Last active December 4, 2017 09:12
Advent of Code
import functools
def captcha(iterable):
saved = []
for idx, element in enumerate(iterable): #idx is the index
saved.append([element, iterable[idx - 1]]) #pair the next number
return functools.reduce(lambda x, y: x+y,[int(i[0]) for i in saved if i[0] == i[1]])
# returns an array of numbers if the number equals the number in its pair
# reduce the array by adding each value to the next
@matthewbadeau
matthewbadeau / gist:ebaf6cc8713191d45879b368ae24893c
Created November 28, 2016 08:19 — forked from alphazo/gist:3303282
Clone MiFare cards using chinesse UUID writable cards

libnfc supports UUID writable cards and even has some dedicated tools for them.

However it doesn't work with some of the cards found on eBay that are even simpler to use. Sector 0 is unlocked and can be written without any additional commands. libnfc requires a small patch to get it working.

Following has been tested under ArchLinux with modified libnfc 1.5.1, mfoc 0.10.2 and a SCL3711 dongle.

Patch & recompile libnfc

The patch is fairly simple, open libnfc-1.5.1/utils/nfc-mfclassic.c and comment 2 lines (it was lines 384 and 385 for me):

// Try to write the trailer

@matthewbadeau
matthewbadeau / ceph_preflight.sh
Last active August 15, 2016 07:45
Ceph Preflight Checklist
CEPHRELEASE=jewel
wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add -
echo deb https://download.ceph.com/debian-$CEPHRELEASE/ $(lsb_release -sc) main | tee /etc/apt/sources.list.d/ceph.list
apt-get update && apt-get install ceph-deploy ntp -y
CDUSERNAME=cduser
useradd -d /home/$CDUSERNAME -m $CDUSERNAME
echo "$CDUSERNAME ALL = (root) NOPASSWD:ALL" | tee /etc/sudoers.d/$CDUSERNAME
chmod 0440 /etc/sudoers.d/$CDUSERNAME
@matthewbadeau
matthewbadeau / installODBC.sh
Last active October 3, 2016 10:33
Install the latest ODBC to use with R for Ubuntu
#!/bin/bash
set -e
CODENAME=`lsb_release -cs`
RELEASE=`lsb_release -rs`
if ! grep -Fxq "deb http://cran.rstudio.com/bin/linux/ubuntu $CODENAME/" ./sources.list; then
echo "deb http://cran.rstudio.com/bin/linux/ubuntu $CODENAME/" >> ./sources.list;
fi
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
@matthewbadeau
matthewbadeau / keybase.md
Last active August 29, 2015 13:56
Keybase Identity Proof

Keybase proof

I hereby claim:

  • I am matthewbadeau on github.
  • I am matthew (https://keybase.io/matthew) on keybase.
  • I have the public key with fingerprint 908D D0E5 AEFA DC98 6E8E  1139 D0CE ADE2 71B4 DABC

To claim this, I am signing this object:

{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. Thanks.|
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|i
@matthewbadeau
matthewbadeau / gist:3284562
Created August 7, 2012 11:03 — forked from subnetmarco/gist:2939141
Powershell Mashape Authentication
function Get-HMACSHA1([string]$publicKey, [string]$privateKey){
$hmacsha = New-Object System.Security.Cryptography.HMACSHA1
[byte[]]$publicKeyBytes = [System.Text.Encoding]::ASCII.GetBytes($publicKey)
[byte[]]$privateKeyBytes = [System.Text.Encoding]::ASCII.GetBytes($privateKey)
$hmacsha.Key = $privateKeyBytes
[byte[]]$hash = $hmacsha.ComputeHash($publicKeyBytes)
$return = [System.BitConverter]::ToString($hash).Replace("-","").ToLower()