Skip to content

Instantly share code, notes, and snippets.

@artur-kink
artur-kink / fday.c
Last active August 29, 2015 14:05
Get current current day time in fractional days format.
#include <stdio.h>
#include <time.h>
int main(int argc, char** argv){
//Get current time
time_t now = time(0);
struct tm* now_tm = localtime(&now);
//Get midnight today
struct tm today;
@artur-kink
artur-kink / hellodolly.py
Created August 15, 2014 22:30
Gnome 2 Hello Dolly panel applet that shows random Hello Dolly lyrics. Inspired by a Wordpress plugin that does the same.
#!/usr/bin/python
import sys
import gtk
import pygtk
import gnomeapplet
import random
import time
import threading
@artur-kink
artur-kink / randomavatar.sh
Created August 17, 2014 03:41
Set your user avatar to a random image in your pictures folder, Centos 6.5 . Run at login to randomise image at each login.
#!/bin/bash
randomimage=`ls $HOME/Pictures | grep ".png\|.jpg" | shuf -n 1`
cp $HOME/Pictures/$randomimage $HOME/.face
@artur-kink
artur-kink / Controller.hpp
Created August 19, 2014 03:17
C++ Webserver using libmicrohttpd. A simple wrapper for libmicrohttpd to create websites using C++.
#ifndef _CONTROLLER_
#define _CONTROLLER_
#include <sstream>
/**
* Base controller for handling http requests.
*/
class Controller{
@artur-kink
artur-kink / age.c
Created September 9, 2014 17:46
Shell program to display age of person given their date of birth.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
void printhelp(){
printf("Get age of person.\n\n");
printf("Usage: age -d <day> -m <month> -y <year>\n");
printf("Arguments\n");
printf(" -h\tprint this.\n");
@artur-kink
artur-kink / bankers.go
Created September 14, 2014 02:45
A simple shell program for a step by step walkthrough of a bankers algorithm.
package main
import "fmt"
import "math/rand"
import "time"
func main() {
var resources = 3
resource_totals := make([]int, resources)
@artur-kink
artur-kink / sql.c
Created November 22, 2016 05:08
Doxygen sql codeblock test
/**
* @file sql.c sql queries
*/
/*!
* @page sqltest SQL code test
*
* ~~~~~~~{.sql}
* CREATE PROCEDURE GetUser
* @LastName nvarchar(50),
* @FirstName nvarchar(50)
@artur-kink
artur-kink / CPosition.h
Created November 29, 2016 04:07
Doxygen missing @param warnings bug test
/**
* @file CPosition.h file
*/
/**
* @brief nonclassfunc
*/
void nonclassfunc(int x, int y);
/**