Skip to content

Instantly share code, notes, and snippets.

View greenygh0st's full-sized avatar
🏠
Working from home - like a lot of us...

Dale Myszewski greenygh0st

🏠
Working from home - like a lot of us...
View GitHub Profile
@yaraki
yaraki / dijkstra.rb
Created February 3, 2012 13:58
Dijkstra Shortest Path Algorithm in Ruby
#!/usr/bin/ruby1.9.1 -Kw
# -*- coding: utf-8 -*-
class Edge
attr_accessor :src, :dst, :length
def initialize(src, dst, length = 1)
@src = src
@dst = dst
@length = length
@rishimukherjee
rishimukherjee / facepass.py
Created March 27, 2012 21:13
Example of use of SimpleCV. This creates a face recognized password.
#!/usr/bin/python
import time
from SimpleCV import Color, Image, np, Camera
cam = Camera() #initialize the camera
quality = 400
minMatch = 0.3
try:
password = Image("password.jpg")
@andrekandore
andrekandore / gist:3140554
Created July 19, 2012 03:27 — forked from RiANOl/gist:1077760
AES128, AES256 encrypt/decrypt in Ruby
require "openssl"
require "digest"
def aes128_encrypt(key, data)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.update(data) + aes.final
end
@pmhsfelix
pmhsfelix / gist:4151369
Created November 26, 2012 23:33
Generating and validating JWT tokens using JWTSecurityTokenHandler
[Fact]
public void First()
{
var tokenHandler = new JWTSecurityTokenHandler();
var symmetricKey = GetRandomBytes(256/8);
var now = DateTime.UtcNow;
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@kethinov
kethinov / walksync.js
Created September 22, 2013 09:04
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@jogleasonjr
jogleasonjr / SlackClient.cs
Last active October 20, 2023 15:54
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{
@jrgcubano
jrgcubano / gist:56e3204ecc661b09c16a
Last active August 13, 2017 12:51
Facial recognition and training with node js
// Starkflow comments + github project node js
// + https://github.com/jrgcubano/face-detection-node-opencv
// + http://blog.stevenedouard.com/stroll-node-facial-recognition-3rd-party-apis/
I believe that you're using the node-opencv library ? You will need some more steps. You have to train your opencv system which than allows you to use the method "predictSync" from FaceRecongizer().
The node-opencv library has a FaceRecognizer Object which you first initialize.
Initialize FaceRecognizer: var FaceRecognizer = new cv.FaceRecognizer();
You have to read all the images, create a specific array and train your FaceRecognizer with that. For my purpose, I'm saving each user in a DB and they get a unique ID which I'm using to create a specific subfolder and this is later used. Here is my code:
@StevenGFX
StevenGFX / dcs-a10c-start-up-checklist.txt
Last active May 20, 2020 02:44
DCS A-10C Start-up Checklist #dcs
1. AC GEN PWR - Up (Left & Right) [right, electrical control panel]
2. BOOST PUMPS WING - Up (Left & Right) [left, fuel system control panel]
3. BOOST PUMPS MAIN - Up (Left & Right) [left, fuel system control panel]
4. BATTERY PWR - Up [right, electrical control panel]
5. INVERTER STBY - Up [right, electrical control panel]
6. SIGNAL LIGHTS LAMP TEST (check all warning lights) [left, auxiliary lighting control panel]
7. FIRE DETECT BLEED AIR LEAK TEST (check engine fire light, bleed air leak light on caution annunciation panel) [left, auxiliary lighting control panel]
8. TEST IND (fuel display select set to INT. needles should be just above 4000lbs depending on fuel load. needles should drop to ~3000lbs +/-200. total should hit 6000lbs +/-200) [center, fuel panel]
9. FUEL DISPLAY SELECT - MAIN
10. OXYGEN SUPPLY (green wheel. check flow indicator is blinking) - Up [right, oxygen control panel]