This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement; | |
using System.Data.SqlClient; | |
using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.Schema; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------- | |
----------- Setup------------ | |
------- Pick a test db ------ | |
----------------------------- | |
SET NOCOUNT ON; | |
GO | |
CREATE SCHEMA Sec; | |
GO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"database/sql" | |
"fmt" | |
_ "github.com/denisenkom/go-mssqldb" | |
"log" | |
"os" | |
"strings" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @dest_path_file NVARCHAR(MAX) | |
DECLARE @dest_path_log NVARCHAR(MAX) | |
SET @dest_path_file = 'C:\pippo\pluto'; | |
SET @dest_path_log = 'C:\pippo\plog'; | |
DECLARE cdb CURSOR FOR | |
SELECT name, database_id FROM sys.databases WHERE database_id > 4; | |
OPEN cdb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn generate_signature(policy_name: &str, hmac_key: &str, url: &str, ttl: Duration) -> String { | |
let expiry = chrono::UTC::now().add(ttl).timestamp(); | |
debug!("expiry == {:?}", expiry); | |
let url_encoded = utf8_percent_encode(url, HTTP_VALUE_ENCODE_SET); | |
debug!("url_encoded == {:?}", url_encoded); | |
let str_to_sign = format!("{}\n{}", url_encoded, expiry); | |
debug!("str_to_sign == {:?}", str_to_sign); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn submit_event(namespace: &str, | |
event_hub: &str, | |
policy_name: &str, | |
key: &str, | |
event_body: (&mut Read, u64), | |
duration: Duration) | |
-> Result<(), AzureError> { | |
// prepare the url to call | |
let url = format!("https://{}.servicebus.windows.net/{}/messages", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@events = | |
EXTRACT SensorId int, | |
Data DateTime, | |
Value float, | |
State string | |
FROM "/user/mindflavor/sensori_arpa_2015_noheader.csv" | |
USING Extractors.Csv(); | |
OUTPUT @events | |
TO "/user/mindflavor/output/clone.tsv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@events = | |
EXTRACT SensorId int, | |
Data DateTime, | |
Value float, | |
State string | |
FROM "/user/mindflavor/sensori_arpa_2015_noheader.csv" | |
USING Extractors.Csv(); | |
@gb = | |
SELECT COUNT( * ) AS cnt, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@stations = | |
EXTRACT SensorId int, | |
SensorType string, | |
Measure string, | |
StationId int, | |
StationName string, | |
Height int, | |
Province string, | |
City string, | |
Address string, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@stations = | |
EXTRACT SensorId int, | |
SensorType string, | |
Measure string, | |
StationId int, | |
StationName string, | |
Height int, | |
Province string, | |
City string, | |
Address string, |
OlderNewer