Skip to content

Instantly share code, notes, and snippets.

View secretGeek's full-sized avatar
😮‍💨
just-so-tired

Leon Bambrick secretGeek

😮‍💨
just-so-tired
View GitHub Profile
@secretGeek
secretGeek / golfquine.cs
Created February 11, 2016 13:02
golf quine in c# (157 bytes)
class c{static void Main(){var s="class c{{static void Main(){{var s={0}{1}{0};System.Console.Write(s,(char)34,s);}}}}";System.Console.Write(s,(char)34,s);}}
using System;
namespace Quine
{
class Program
{
static string[] program = new string[] {
"using System;",
"namespace Quine",
"{",
" class Program",
dir *.md | % { $file = $_.Name; get-content $_ | select-string -pattern "//TODO:" | % { $file.substring(0,10) + ":" + $_.ToString().replace("//TODO:","").trim() }} | more
@secretGeek
secretGeek / bake.ps1
Created October 1, 2014 02:50
bake.ps1 -- generates an epub for me, using pandoc, with my chosen cover image, stylesheet, yaml metadata and my chapters.
pandoc -f markdown -t epub --epub-cover-image=cover.jpg -o yfp.epub --smart --toc --epub-stylesheet=epub.css title.txt .\00_Title.md .\01_Before_we_begin.md .\02_ideas.md .\03_Choose_your_concept.md .\04_Landing_page.md .\05_Pricing.md .\06_Build_your_product.md .\07_Launch_time.md .\08_Optimize.md .\09_Support.md .\10_Refresh.md .\11_tools.md .\12_Glossary.md .\13_reading_list.md --epub-chapter-level=3
@secretGeek
secretGeek / chapters.ps1
Last active August 29, 2015 14:07
chapters.ps1 -- gives me a basic table of contents for the book I'm working on, include count of words and remaining todo's in each chapter.
$totalWords = 0
$totalTodo = 0;
dir *.md | % {
$name = $_.Name;
$len = $_.length;
$todos = (get-content $_ | select-string -pattern "//TODO:").length
$subChapters = (get-content $_ | select-string -pattern "^### ").length
$words = (get-content $_ | measure-object -word).Words;
$totalWords = $totalWords + $words;
@secretGeek
secretGeek / stats.ps1
Last active August 29, 2015 14:07
stats.ps1, summarize the numbers of words in each markdown file, and display them by size descending.
$x = "";
dir *.md | % { $x = $_.Name; type $_.Name | Measure-Object –Word | % { ("{0,5}" -f $_.Words) + " " + $x } } | sort -desc
@secretGeek
secretGeek / progress.ps1
Last active August 29, 2015 14:07
progress.ps1 (assumes commits are handled by count.ps1) give details about daily word and task counts, and show today's progress as a percent of goal.
# draw a bar (in the console) of a given size, n
function bar($n) {
$co = "green";
if ($n -lt 100) {
$co = "red"; #less than 100%: is RED
} elseif ($n -ge 500) {
$co = "blue"; #greater than 500% is Blue
}
1..([system.math]::min(50,$n/10)) | % { barbit($co);}