Skip to content

Instantly share code, notes, and snippets.

View FredrikAugust's full-sized avatar
🦦
Otters enjoy spending time in water.

Fredrik A. Madsen-Malmo FredrikAugust

🦦
Otters enjoy spending time in water.
View GitHub Profile
<html>
<head>
<meta http-equiv='refresh' content='5'/>
<title>ESP8266 Demo</title>
<style>
body {
background-color: #cccccc;
font-family: Arial, Helvetica, Sans-Serif;
color: #000088;
}
@FredrikAugust
FredrikAugust / denmark-contour.R
Created July 14, 2015 03:20
render denmark as a contour in R
f <- function(m) t(m)[,nrow(m):1]
denmark <- f(f(as.matrix(read.csv('denmark.csv'))))
contour(denmark)
@FredrikAugust
FredrikAugust / gist:80ffa3fa652d7577b22f
Created March 25, 2015 19:28
Check for updated file - Linux GDrive
def fileUpdate(fileNameArray, callback): # I am plannig to have the fileNameArray also contain the full path to the file, as this would make it a lot easier
for fileName in fileNameArray:
os.system("stat {} > editedTime.log".format(fileName))
lastEdited = None
with open("editedTime.log", "r+") as file:
content = file.read()
lastEdited = re.search("(?P<edit>)", content, RE.VERBOSE) # Replace the regular expression with some RegEx that gets the date and time
@FredrikAugust
FredrikAugust / SimpleGUI_Sketch.cs
Last active August 29, 2015 14:16
Simple GUI Sketch
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SimpleGUI_sketch
{
interface IOption
{
@FredrikAugust
FredrikAugust / PersonPrinter.cs
Created March 4, 2015 17:25
C# Interface Super-Basic
using System;
namespace PersonPrinter
{
interface IPerson
{
string Name { get; set; }
int Age { get; set; }
}
@FredrikAugust
FredrikAugust / test.cs
Last active August 29, 2015 14:16
C# Testing
using System;
class test {
public static void Main() {
Console.WriteLine("Hello, World!");
}
}
@FredrikAugust
FredrikAugust / simple_gui.py
Last active August 29, 2015 14:15
Tinkering with Tkinter
from Tkinter import *
class MyApp:
def callback(self):
print self.inputValue.get()
def key(self, event):
# print "debug: pressed char {}".format(repr(event.char))
if event.char == "\r":
self.myParent.destroy()
@FredrikAugust
FredrikAugust / py_mail.py
Created February 22, 2015 01:11
Python Mail Checker
# Python GMail Checker
# Written by Fredrik A. Madsen-Malmo [@MrMadsenMalmo]
# Import modules
import os
import RPi.GPIO as GPIO
from time import sleep
import imaplib
@FredrikAugust
FredrikAugust / py_weather.py
Created February 22, 2015 01:09
Python Weather
# coding=<utf-8>
# Weather Check
# Created by MrMadsenMalmo and MrTijn
# Import libs
import pywapi as weatherModule
import sys
import string
from time import sleep
@FredrikAugust
FredrikAugust / node_io.js
Created February 22, 2015 01:07
Node.js IO
// Require the filesystem module from Node.js
var fs = require("fs");
// Create a new date at this exact moment
var date = new Date();
// Retrieve the date, month, hour, minute and second
var dateDate = date.getDate(),
dateMonth = date.getMonth() + 1, // Since the getMonth method is 0-based we need to add one to make it 1-12
dateHour = date.getHours(),