Skip to content

Instantly share code, notes, and snippets.

View richardkundl's full-sized avatar

Richard Kundl richardkundl

View GitHub Profile
@bengriffiths1605
bengriffiths1605 / snipe-it.md
Last active April 15, 2024 16:31
Hosting Snipe-IT on Ubuntu 20.04 (AWS EC2)

Introduction

Snipe-IT is an open-source asset management system that empowers IT departments and organisations to manage their asset assignments and tracking through a powerful and practical user interface. It's time to say goodbye to missing assets, complicated spreadsheets and inefficient workflows. Snipe-IT has grown into one of the best asset management systems since its launch in 2013 and is still actively developed with new releases every few weeks.

Amazon Web Services (AWS) offers a wide variety of services that provide on-demand cloud computing platforms to individuals, companies and governments, on a paid subscription basis. In this guide, we will be using the Elastic Compute Cloud (EC2) service. EC2 allows users to rent virtual computers on which to run their computer applications.

Please Note: If you are a new AWS customer, you receive 12 months of free tier usage. For EC2 this includes 750 computing hours per month. The webserver deployed in this guide is free tier eligible. You can le

@richardkundl
richardkundl / setInterval.js
Created November 27, 2013 10:42
An alternative to Javascript's evil setInterval: - Doesn't care whether the callback is still running or not - Ignores errors - Isn't that flexible Thanks: http://www.thecodeship.com/web-development/alternative-to-javascript-evil-setinterval/
function interval(func, wait, times){
var interv = function(w, t){
return function(){
if(typeof t === "undefined" || t-- > 0){
setTimeout(interv, w);
try{
func.call(null);
}
catch(e){
t = 0;
@richardkundl
richardkundl / RecursionStackoverflow.cs
Created November 26, 2013 10:49
Ensures that the remaining stack space is large enough to execute the average .NET Framework function.
try
{
RuntimeHelpers.EnsureSufficientExecutionStack();
// call recursion
}
catch (InsufficientExecutionStackException)
{
// catch recursion stackoverflow exception
}
catch
@richardkundl
richardkundl / LevenshteinDistance.cs
Last active December 28, 2015 08:08
Computate Levenshtein distance, not a normal returns format. It returns the percentage difference: 0 == perfect match; 100 == totaly different
/// <summary>
/// Computate Levenshtein distance, not a normal returns format.
/// It returns the percentage difference.
/// </summary>
/// <param name="expected"> expected word </param>
/// <param name="actual"> actual word </param>
/// <returns> Value between 0 - 100
/// 0==perfect match 100==totaly different </returns>
public static byte GetLevenshteinDistance(string expected, string actual)
{
@richardkundl
richardkundl / Sift3Distance.cs
Created November 14, 2013 15:15
Get Sift3 distance from two words. Simmilar to the Levenshtein distance, but it's four time faster. Verifying that(http://norvig.com/ngrams/) data sets.
/// <summary>
/// Get Sift3 distance from two words.
/// (eg: spell checking)
/// </summary>
/// <param name="source"> source string </param>
/// <param name="actual"> actual string </param>
/// <param name="maxOffset"> max offset </param>
/// <returns> The distance of the two words. </returns>
public static float GetSift3Distance(string source, string actual, int maxOffset)
{
@richardkundl
richardkundl / simpleajaxcache.js
Created November 1, 2013 17:56
Simple way to caching AJAX request result
// define cache
var cache = {};
// ...
// within the AJAX callback
cache[url] = data;
// ...
// within callback that would set forth a request
if(cache[url]) {
var net = require('net');
net.createServer(function(sock) {
console.log('rikveszt!');
var start = new Date().getTime();
var payload = '';
for (var i = 0; i < 10000; i++) {
payload += 'LoL';
}
var j = 0;
@richardkundl
richardkundl / jquery-rval.js
Created March 27, 2013 14:19
JQuery read textbox placeholder member, if the textbox value is empty. Thats wrong. This rVal return empty value, never return placeholder value.
jQuery.fn.rVal = function () {
if (this[0]) {
var ele = $(this[0]);
if (ele.attr('placeholder') != '' && ele.val() == ele.attr('placeholder')) {
return '';
} else {
return ele.val();
}
}
return undefined;
@richardkundl
richardkundl / GenericEvaulatingOrderBy.cs
Last active December 15, 2015 11:29
Extending linq order by method.
namespace Common.Extension
{
using System.Linq;
using System.Linq.Expressions;
public static class GenericEvaulatingOrderBy
{
private static IOrderedQueryable<T> OrderingHelper<T>(IQueryable<T> source, string propertyName, bool descending, bool anotherLevel)
{
var param = Expression.Parameter(typeof(T), "p");
@richardkundl
richardkundl / PageHelper.cs
Created February 13, 2013 21:13
Find custom controls in aspx page any depth
/// <summary>
/// Extension method for the "Page" class
/// </summary>
public static class PageHelper
{
/// <summary>
/// Find control in the page
/// </summary>
/// <typeparam name="T">return control type(eg. TextBox)</typeparam>
/// <param name="page">Actual Page</param>