Skip to content

Instantly share code, notes, and snippets.

@jkreileder
jkreileder / whoop-goldencheetah.py
Last active November 20, 2023 17:38
Python 3 script to export WHOOP Strap recovery data for use with Golden Cheetah
#!/usr/bin/env python3
import requests # for getting URL
import json # for parsing json
from datetime import datetime # datetime parsing
import pytz # timezone adjusting
import csv # for making csv files
import os
#################################################################
@lauriii
lauriii / validate_finnish_business_id.php
Last active October 21, 2022 12:40
Y-Tunnus tarkistus (Finnish business ID validator)
<?php
function validate_company_id($company_id) {
// Some old company id's have only 6 digits. They should be prefixed with 0.
if (preg_match("/^[0-9]{6}\\-[0-9]{1}/", $company_id)) {
$company_id = '0' . $company_id;
}
// Ensure that the company ID is entered in correct format.
if (!preg_match("/^[0-9]{7}\\-[0-9]{1}/", $company_id)) {
@abombss
abombss / git-submodule-reload.ps1
Created November 20, 2011 21:06
Powershell to re-clone all git submodules
$hash = @{}; $list = cat .gitmodules | where { $_ -like "*=*" } | foreach { $_.Split("=")[1].Trim() }; while ($list) { $key, $value, $list = $list; $hash[$key]=$value }; $hash.GetEnumerator() | foreach { & git submodule add $_.Value $_.Name }
@mkuklis
mkuklis / mongoid_rake.rake
Created November 12, 2010 18:12
few rake tasks to interact with mongodb via mongoid
namespace :mongo do
def confirm(message)
print "\n#{message}\nAre you sure? [y/n] "
# STDIN is not supported on heroku :/
raise 'Aborted' unless STDIN.gets.chomp == 'y'
end
desc "gets database"
task :db => :environment do