Skip to content

Instantly share code, notes, and snippets.

View gyurisc's full-sized avatar
🏠
Working from home

gyurisc gyurisc

🏠
Working from home
View GitHub Profile
@amejiarosario
amejiarosario / static_server.js
Created August 24, 2016 21:49
Node.js quick file server (static files over HTTP) using es6+
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
anonymous
anonymous / simple_barcode_detection.py
Created November 4, 2015 09:42
Barcode detection from Adrian Rosebrock, updated to be compatible with OpenCV 3 (tested with OpenCV 3.0.0 and Python 2.7.9).
# This file was updated in order to support OpenCV v.3. (note lines 13, 14, 33, 43)
# import the necessary packages
import numpy as np
import cv2
def detect(image):
# convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
@brennanMKE
brennanMKE / .bash_profile
Last active June 20, 2018 23:12
Open in Visual Studio Code
# Add the alias below to ~/.bash_profile on a Mac
# Save the file and run: source ~/.bash_profile
alias code='open $@ -a "Visual Studio Code"'
@richardsawyer
richardsawyer / gist:62596e14d1ec4d148b28
Created April 25, 2015 04:16
Using openCvSharp to locate barcodes
// optimized to find a vertical barcode in an image
// inspired by http://www.pyimagesearch.com/2014/11/24/detecting-barcodes-images-python-opencv/
using System;
using System.Drawing;
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace LocateBarcode
@carolynvs
carolynvs / install-mono.sh
Last active April 19, 2020 11:14
Install Mono on Ubuntu
wget http://download.mono-project.com/repo/xamarin.gpg
sudo apt-key add xamarin.gpg
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee --append /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
sudo certmgr -ssl -m https://go.microsoft.com
sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
sudo certmgr -ssl -m https://nuget.org
mozroots --import --sync
@mombrea
mombrea / iOS-UploadImage.h
Created January 17, 2014 01:49
example of a multi-part form post in objective-c
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
@PaulStovell
PaulStovell / Bootstrapper.cs
Created May 9, 2013 10:03
The Octopus Nancy error handling strategy
protected override void RequestStartup(ILifetimeScope requestContainer, IPipelines pipelines, NancyContext context)
{
pipelines.OnError.AddItemToEndOfPipeline((z, a) =>
{
log.Error("Unhandled error on request: " + context.Request.Url + " : " + a.Message, a);
return ErrorResponse.FromException(a);
});
base.RequestStartup(requestContainer, pipelines, context);
}
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@madrobby
madrobby / everytimezone.coffee
Created April 17, 2011 13:36
First conversion of http://everytimezone.com/ JavaScript code to CoffeeScript
# Two things are important to note:
#
# 1) The code is fugly, because it was a JavaScript/iPad experiment.
# I know that it is ugly, so pretty please don't comment on that part.
# 2) I tried to use as many CoffeeScript features as possible,
# including but not limited to list comprehensions,
# heredocs, destructuring assignment and also the "do" operator
#
# I welcome comments about stuff that is not CoffeeScripty enough, or what I should
# write differently.
@artlung
artlung / sitemap.xml.php
Created October 14, 2009 21:42
Generate XML sitemap from list of urls
<?php
/**
*
* This is a quick way to turn a simple text file
* with a list of urls in a text file (sitemap-urls.txt)
* into a valid XML Sitemap:
* http://en.wikipedia.org/wiki/Sitemaps
* Put this file sitemap.xml.php and sitemap-urls.txt at
* the webroot http://example.com/sitemap.xml.php