This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
<svg width="256pt" height="256pt" viewBox="0 0 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg"> | |
<path fill="#ffffff" d=" M 0.00 0.00 L 256.00 0.00 L 256.00 256.00 L 0.00 256.00 L 0.00 0.00 Z" /> | |
<path fill="#000000" d=" M 51.79 54.97 C 66.87 55.07 81.96 54.65 97.04 55.02 C 101.97 54.20 106.20 56.81 110.45 58.72 C 108.19 66.27 102.87 72.29 99.73 79.42 C 98.02 97.62 99.25 115.95 99.14 134.20 C 118.39 115.21 137.51 96.08 156.52 76.86 C 153.07 72.85 149.16 69.19 146.13 64.84 C 146.65 60.65 149.75 55.37 154.98 57.10 C 172.00 56.76 189.04 56.73 206.06 57.00 C 210.55 56.80 212.70 61.61 213.88 65.17 C 214.89 68.42 211.43 70.50 209.78 72.76 C 163.08 119.37 116.47 166.07 69.78 212.69 C 65.57 211.07 61.65 208.82 57.85 206.41 C 57.90 162.72 58.43 119.01 57.72 75.34 C 54.17 72.88 50.16 71.19 46.51 68.89 C 47.89 64.11 49.84 59.53 51.79 54.97 Z" /> | |
<path fill="#ffffff" d=" M 54 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Roll-Dice { | |
param( | |
[Parameter( | |
Mandatory = $true, | |
#Position = 0, | |
ValueFromPipeline = $true, | |
ValueFromPipelineByPropertyName = $true)] | |
[string]$ndm | |
) | |
#should probably check for input not matching ndm pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem: | |
# In a country in which people only want boys every family continues to have children until they have a boy. | |
# If they have a girl, they have another child. If they have a boy, they stop. | |
# What is the proportion of boys to girls in the country? | |
$global:m=0; $global:f=0; | |
function havebabiesuntilboy(){ | |
while($true){ | |
if ((Get-Random -Minimum 0 -Maximum 2) -eq 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] Param ( | |
[Parameter(Position = 0, Mandatory = $True, ValueFromPipelineByPropertyName = $True)] | |
[ValidateNotNullOrEmpty()] | |
[Alias('FullName')] | |
[String] | |
$filePath | |
) | |
function ConvertFrom-md($mdText){ | |
$response = Invoke-WebRequest -Uri 'https://api.github.com/markdown/raw' -Method Post -body "$mdText" -ContentType "text/plain" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$today = (Get-Date) | |
$bday = $( | |
$DOB = Read-Host "What is your birthday?" | |
if ($DOB){ $(get-date ($DOB)) }else{$(get-date)} #Default to today to avoid errors when nothing is entered. | |
) | |
write-host "You were born on $($bday.ToLongDateSTring())." | |
write-host "You have lived $(($today - $bday).Days) days." | |
100,82,76,65|%{ write-host "If you live to be $_ years old, then you have"(( $bday.AddYears($_) ) - $today).Days "days left to live."} | |
Write-Host "Make the most of them!" | |
Write-Host "But remember, there is only now." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
from collections import defaultdict | |
def freq_of_sums(a, b, v): | |
if (b == 0): | |
global freq | |
if freq.has_key(v): | |
freq[v]=freq[v]+1 | |
else: | |
freq[v]=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple Rock, Paper Scissors Game in Powershell by pohatu | |
# Uses very cool Select-Item function by James O'Neill | |
# Presented here: http://blogs.technet.com/b/jamesone/archive/2009/06/24/how-to-get-user-input-more-nicely-in-powershell.aspx | |
# | |
# Also uses a clever trick to make remainder act like modulo for negative numbers presented by StackOverflow user polygenelubricants | |
# here: http://stackoverflow.com/questions/3417183/modulo-of-negative-numbers/3417598#3417598 | |
# You can see the difference between columns labeled Excel:(b-a)%3 and PS:(b-a)%3 column | |
# | |
# | |
# p1 p2 a-b xls:a-b%3 result PS:(b-a)%3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fizzbuzz(){ | |
for ($i=1; $i -lt 101; $i++){ | |
$db=0; | |
if ($i%3 -eq 0){$db = $db -bor 1} | |
if ($i%5 -eq 0){$db = $db -bor 2} | |
switch($db) | |
{ | |
1 { Write-Output "Fizz"} #01 | |
2 { Write-Output "Buzz"} #10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int i=0; | |
for (i=1; i<101; i++){ | |
int db = 0; | |
db = db ^ 1 * (!(i%3)) ^ 2*(!(i%5)); | |
switch (db){ | |
case (1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int i=0; | |
for (i=1; i<101; i++){ | |
int db = 0; | |
db = db ^ 1 * (!(i%3)) ^ 2*(!(i%5)); | |
if (db&1){printf("fizz");} //db=01 or 11 | |
if (db&2){printf("buzz");} //db=10 or 11 |
OlderNewer