Skip to content

Instantly share code, notes, and snippets.

@andreburto
andreburto / vertex_circles
Created August 27, 2016 23:37
Draws circles and makes a picture.
import java.util.*;
XML xml;
String linkUrl = "http://pics.mytrapster.com/yvonne-list.php";
int count = 0;
int w = 100;
float xcoord = 0;
float ycoord = 0;
class Yvonne {
@andreburto
andreburto / OwTest.java
Created August 28, 2016 05:39
OutWrite test
import java.util.*;
import java.text.*;
public class OwTest {
public static int counter = 0;
public static long delay = 100;
public static void main(String[] args) throws InterruptedException {
while (counter < 200) {
@andreburto
andreburto / f_table_access.sql
Created August 31, 2016 14:03
f_table_access
declare
function f_table_access(fi_tbl varchar2,
fi_owner varchar2 default null)
return varchar2 as
v_table varchar2(100);
v_retval varchar2(1);
v_command varchar2(100);
begin
if fi_owner is not null then
v_table := fi_owner||'.'||fi_tbl;
/**********************************************************************
* SANTA TRACKINATOR
* =================
* By: Andy Burton, 2016
*
* This code works in concert with an IFTTT.com applet that send the
* WIFI bit an update. When the update is recieved the LASERPEG pin is
* set high then low to blink lights. The mode of the system can also
* be changed to blink the LASERPEG pin every five seconds instead of
* waiting for an update.
import web
from exceptions import ValueError
urls = ('/', 'Index')
store_url = 'No_url'
class Index:
def GET(self):
@andreburto
andreburto / annicount.py
Last active June 11, 2017 13:03
Count the leap years since a couple was married.
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)
@andreburto
andreburto / admin-login.py
Last active August 11, 2017 02:04
Quickly login to the Django Admin screen
# Python standard library
import os
import getpass
from urlparse import urlparse
# Third-party libraries
import requests
from bs4 import BeautifulSoup
__author__ = 'Andy Burton'
@andreburto
andreburto / plate_ratio.py
Last active October 22, 2017 00:00
Calculate the ratio from System bricks/plates to Technic holes.
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
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">
# 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