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
@FredrikAugust
FredrikAugust / treehouse_user.js
Created February 22, 2015 01:03
Treehouse Node.js Practice
// Store the profile getting here
// Require libs
var http = require("http");
// Define the printMessage function, self-explanatory
function printMessage(username, badgeCount, points) {
var message = username + " has " + badgeCount + " total badge(s) and " + points + " points in JavaScript";
console.log(message);
@FredrikAugust
FredrikAugust / java_practising_console.java
Created February 22, 2015 01:05
Java Console Practise
import java.io.Console;
public class JavaTest {
public static void main(String[] args) {
Console console = System.console();
String firstName;
do {
firstName = console.readLine("What is your name?\n");
@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(),
@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 / 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 / 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 / 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 / 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 / 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 / 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