Skip to content

Instantly share code, notes, and snippets.

@nertim
nertim / CSVToJsonArray.cs
Created December 11, 2017 23:40
CSV To Json Array Azure Function
#r "newtonsoft.json"
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
[{
"@odata.etag": "foo"
},{
"@odata.etag": "bar"
}]
[{
"@odata.etag": "foo"
},{
"@odata.etag": "bar"
}]
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Compose": {
"inputs": "@triggerBody()",
"runAfter": {},
"type": "Compose"
}
},
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"HTTP": {
"inputs": {
"body": "@triggerBody()",
"method": "POST",
"uri": "https://prod-28.brazilus.logic.azure.com:443/workflows/0a1cf518606447afaa5483dfb2355c3f/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=<sig>"
},
@nertim
nertim / sample.query.json
Created July 15, 2016 00:59
sample definition with query action
{
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-04-01-preview/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
class AddSchedulingAppointmentStatuses < ActiveRecord::Migration
def change
create_table :AppointmentStatus do |t|
t.string :code, :limit => 1, :null => false, :unique => true
t.string :descrip, :limit => 30, :null => false
t.timestamps
end
add_index :AppointmentStatus, [:code], :unique => true
@nertim
nertim / Mongo.pp
Created November 23, 2012 20:05
Puppet script to install and run mongodb
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
#####
## source Vikram Dighe
## https://gist.github.com/5aeb4533db6edd94793c
#####
define pparepo($apt_key = "", $dist = $ppa_default_name, $supported = ["precise", "lucid", "hardy"], $ensure = present, $keyserver = "keyserver.ubuntu.com") {
$name_for_file = regsubst($name, '/', '-', 'G')
$file = "/etc/apt/sources.list.d/pparepo-${name_for_file}.list"
@nertim
nertim / fileHelper.php
Created March 14, 2012 15:43
Using PHP to get a list of files from a directory and all its subdirectories
<?php
/**
* A little helper function get all file names from a directory.
*/
function testFiles() {
//Initialize a starting point
$path = getcwd() . "/public/images";
$filesArr = array();