This file contains hidden or 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/bin/perl -w | |
###################################################################### | |
# skip_lines.pl -- skips selected lines of a given file | |
# | |
# perl skip_lines.pl /path/to/file.txt 1,3,4,5 | |
# | | | | |
# script -----+ | | | |
# text file ---------------+ | | |
# comma separated line numbers ---------+ | |
# with no spaces |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Weather Widget 1</title> | |
<script> | |
function getUrl() { | |
return "http://localhost:8080/scratch/weather.xml"; | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Clock Widget 3</title> | |
<script> | |
var hour = 0; | |
var min = 0; | |
var sec = 0; | |
var year = 0; | |
var month = 0 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Polyglot</title> | |
<hta:application applicationname="Polyglot" scroll="no" singleinstance="no" /> | |
<script type="text/vbscript"> | |
Sub Window_onLoad | |
window.resizeTo 250,250 | |
End Sub |
This file contains hidden or 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 main{ | |
Add-Type -AssemblyName presentationframework | |
$html = [string]@" | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello, World!</title> | |
<script> |
This file contains hidden or 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
# Query Yahoo!Weather to get the results. More can be gleaned than just the forecast. | |
function getWeather([string]$city, [string]$state){ | |
$query = "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text='{0}, {1}')" | |
$url = "https://query.yahooapis.com/v1/public/yql?q={0}&format=xml&env=store://datatables.org/alltableswithkeys" | |
$newQuery = $query -f $city, $state | |
$newUrl = $url -f $newQuery | |
[xml]$data = Invoke-RestMethod -Uri $newUrl |
This file contains hidden or 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 main{ | |
Add-Type -AssemblyName presentationframework | |
$xaml = [xml]@" | |
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
x:Name="Window" | |
Title="MainWindow" | |
Width="640" Height="480"> | |
<Grid x:Name="LayoutRoot"> |
This file contains hidden or 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
from __future__ import print_function | |
from sys import exit | |
from math import floor | |
from nose.tools import assert_equals | |
__author__ = "Andy Burton" | |
PLATES_IN_BRICK = 3 |
This file contains hidden or 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
# Python standard library | |
import os | |
import getpass | |
from urlparse import urlparse | |
# Third-party libraries | |
import requests | |
from bs4 import BeautifulSoup | |
__author__ = 'Andy Burton' |
This file contains hidden or 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
import datetime, calendar | |
def find_leap_years_in_marriage(married_year): | |
current_year = datetime.datetime.now().year | |
return sum([1 for year in range(married_year, current_year) if calendar.isleap(year)]) | |
if __name__ == '__main__': | |
import sys | |
leap_year_count = find_leap_years_in_marriage(int(sys.argv[1])) | |
print 'You have {yc} leap years between when you were married and this anniversary.'.format(yc=leap_year_count) |