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
// https://github.com/jfcarr/practical-astronomy-rust/issues/6 | |
use practical_astronomy_rust::moon as M; | |
struct MoonRiseSetInfo { | |
mr_lt_hour: f64, | |
mr_lt_min: f64, | |
mr_local_date_day: f64, | |
mr_local_date_month: u32, | |
mr_local_date_year: u32, |
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/bin/python3 | |
# Example output: | |
# [ Baba O'Riley | The Who | 1970 (0:05:09)] | |
import datetime | |
import subprocess | |
def get_value(full_array, position): |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace UpdateCollection | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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
/* | |
Assertions on doubles are tricky in C, because of the way precision is handled. The default precision | |
used in things like displaying and comparing is 6 decimal places, even though the internal precision value | |
is much higher. This makes things like assertions difficult, if you want to assert on any value other | |
than the default 6 decimal places. Here's a way to do it by converting both values to strings before | |
the assertion. | |
*/ | |
#include <math.h> | |
#include <stdio.h> |
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/bin/python | |
import imaplib | |
import sys | |
class MailHandler: | |
def CheckUnread(self, username, password): | |
imapConnection = imaplib.IMAP4_SSL('your.mailserver.com',993) | |
imapConnection.login (username, password) | |
imapConnection.select() |
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
#!/bin/bash | |
LASTGMAIL="$(curl -u johndoe:mypassword --silent 'https://mail.google.com/mail/feed/atom' | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n 's/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p' | wc -l)" | |
if [ $LASTGMAIL -ne 0 ] | |
then | |
echo "$LASTGMAIL : johndoe@gmail.com" | |
fi |
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
#!/bin/bash | |
curl -u johndoe:mypassword --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | sed -n "s/<title>\(.*\)<\/title.*name>\(.*\)<\/name>.*/\2 - \1/p" |
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
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
namespace Console1 | |
{ | |
public static class ListExtension | |
{ | |
public static IEnumerable<T> RemoveDuplicates<T>(this List<T> inputList) |
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
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
namespace Console1 | |
{ | |
class Program | |
{ |
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
# I use a Python script to pull current weather conditions from the NOAA web service API. The NOAA web | |
# service does not return a windchill value for all locations, but given temperature, relative humidity, | |
# and wind speed you can calculate a “feels like” temperature as follows. | |
# This code assumes units of Fahrenheit, MPH, and Relative Humidity by percentage. In this example, a | |
# temperature of 35F, wind speed of 10mph, and relative humidity of 72% yields a "feels like" value of 27.4F | |
import math | |
vTemperature = float(35) |