Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@bellbind
bellbind / ecc.py
Created December 1, 2011 08:08
[python]basics of elliptic curve cryptography
# Basics of Elliptic Curve Cryptography implementation on Python
import collections
def inv(n, q):
"""div on PN modulo a/b mod q as a * inv(b, q) mod q
>>> assert n * inv(n, q) % q == 1
"""
for i in range(q):
if (n * i) % q == 1:
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@trbngr
trbngr / EventStoreService.cs
Last active July 4, 2017 21:29
EventStore as a windows service w/ TopShelf
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
namespace EventStoreService
{
public class EventStoreService
{
@bleroy
bleroy / XmlHelper.cs
Last active September 18, 2022 03:11
A C# helper class to read and write XML from and to objects
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Linq;
namespace Nwazet.Commerce.Helpers {
public static class XmlHelper {
/// <summary>
/// Like Add, but chainable.
@TooTallNate
TooTallNate / agent.js
Last active October 12, 2022 06:37
Node.js `http.Agent` class implementations...
/**
* Module dependencies.
*/
var net = require('net');
var inherits = require('util').inherits;
var EventEmitter = require('events').EventEmitter;
/**
@edward
edward / gist:8572602
Created January 23, 2014 03:59
Running a Happy Hackfest Lessons from many Open Data hackfests

Happy Hackfests

Hi, my name is Edward. I work for an excellent company called Shopify. In my spare time, I put on hackfests with some excellent friends of mine.

Once upon a time, I went to a lot of tech-related meetups. I want to enough meetups that I started to know pretty much everyone who showed up. It was pretty much the same dudes interested in the same things every. single. time. Nice guys, but I wanted something a little different.

Fast-forward to some really awesome party I was at. There were all sorts of people from different backgrounds at this party, and they were all really smart, and really interesting. I met biologists specializing in arctic bacteria that live in semi-transparent rocks that naturally create condensation so that the bacteria can live. I met librarians who told me about the crazy political and philosophical beliefs that go into systems like the Library of Congress system of organizing books, and how you can still see the history of feminism and women’s suffrage just by lookin

@pasupulaphani
pasupulaphani / get_resp.js
Last active August 29, 2015 13:57
Handling requests and parsing responses via http.get or http.response
var Fiber = require('fibers')
var getResp = function (url, callback) {
var fn = Fiber(function () {
var resp = handleRequest(url);
if (resp.statusCode != 200) {
//handle success response
} else {
//handle other responses here
}
@tracker1
tracker1 / 01-directory-structure.md
Last active May 4, 2024 19:55
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@cicorias
cicorias / makeSH256Cert.cmd
Created November 7, 2014 17:44
Make a self signed SH256 certificate...
makecert -pe -n "CN=ppistablet" -a sha256 -sky Exchange -eku 1.3.6.1.5.5.7.3.3 -ic c:\ppis\CA.cer -iv c:\ppis\CA.pvk -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -cy end -sv c:\ppis\ppistablet.pvk c:\ppis\ppistablet.cer
pvk2pfx -pvk c:\ppis\ppistablet.pvk -spc c:\ppis\ppistablet.cer -pfx c:\ppis\ppistablet.pfx -pi xxxxx
@cicorias
cicorias / gist:604286f96c833f246a37
Created February 9, 2015 21:15
Example of Azure Resource Manager Providers for a Subscription
{
"value": [
{
"id": "/subscriptions/<subscriptionId>/providers/Microsoft.Batch",
"namespace": "Microsoft.Batch",
"resourceTypes": [
{
"resourceType": "batchAccounts",
"locations": [