Skip to content

Instantly share code, notes, and snippets.

View 00x29a's full-sized avatar
🌱

Olyn 00x29a

🌱
View GitHub Profile
@Jabarabo
Jabarabo / githubpull.md
Last active May 5, 2024 10:16
Gist of a stolen gist
@zuloo
zuloo / moonphase.sh
Created December 30, 2015 15:28
moonphase bash script
#!/bin/bash
moonphase(){
local lp=2551443
local now=$(date -u +"%s")
local newmoon=592500
local phase=$((($now - $newmoon) % $lp))
local phase_number=$((((phase / 86400) + 1)*100000))
# Multiply by 100000 so we can do integer comparison. Go Bash!
@wilfm
wilfm / grephexcolourcode
Created September 14, 2015 17:54
Grep Hex Colour Codes from file
#!/bin/bash
#get hex codes in form #fff and #ffffff
#checks to see if not - especially needed on #fff matches
#FIXME: - currently prints trailing character
if [[ ! -a $1 ]]; then
echo File not found
exit 1
fi
sed ':a;N;$!ba;s/\n/ /g' "$1" | grep -o '\#[0-9a-fA-F]\{3\}[^0-9a-fA-F]' | sed 's/[^0-9a-fA-F#]//g' | sort -u
@miklb
miklb / moonphase.py
Created July 1, 2015 07:12
Calculate Lunar Phase
#!/usr/bin/env python
"""
moonphase.py - Calculate Lunar Phase
Author: Sean B. Palmer, inamidst.com
Cf. http://en.wikipedia.org/wiki/Lunar_phase#Lunar_phase_calculation
"""
import math, decimal, datetime
dec = decimal.Decimal