Skip to content

Instantly share code, notes, and snippets.

View sfrechette's full-sized avatar

Stéphane Fréchette sfrechette

View GitHub Profile
@sfrechette
sfrechette / ip_address_parallels
Last active August 29, 2015 14:07
How to get the IP address used by a Parallels VM from the host?
//How to get the IP address used by a Parallels VM from the host?
prlctl exec "VM Name goes here" ipconfig | grep "IPv4" | grep -o '\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}'
prlctl exec "VM Name goes here" ifconfig eth1 | grep "inet " | grep -o 'addr:\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}' | grep -o '\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}\.\d\{1,3\}'
@sfrechette
sfrechette / LotteryNumberGenerator.sql
Last active October 8, 2016 04:50
T-SQL Lottery Number Generator
WITH
L0 AS (SELECT 0 AS C UNION ALL SELECT 0),
L1 AS (SELECT 0 AS C FROM L0 AS A
CROSS JOIN L0 AS B),
L2 AS (SELECT 0 AS C FROM L1 AS A
CROSS JOIN L1 AS B),
L3 AS (SELECT 0 AS C FROM L2 AS A
CROSS JOIN L2 AS B),
Nums AS (SELECT TOP(49) ROW_NUMBER()
OVER(ORDER BY (SELECT 0)) AS n
@sfrechette
sfrechette / DimDate.sql
Created June 13, 2014 00:03
Create and populate DimDate Table...
create table dbo.DimDate
(
DateKey int not null,
FullDate date not null,
DayNumberOfWeek tinyint not null,
DayNameOfWeek nvarchar(10) not null,
WeekDayType nvarchar(7) not null,
DayNumberOfMonth tinyint not null,
DayNumberOfYear smallint not null,
WeekNumberOfYear tinyint not null,
@sfrechette
sfrechette / SQLToJSON.sql
Created January 29, 2014 00:03
SQL to JSON | SQL Server T-SQL script
set nocount on
declare @TableViewName nvarchar(128),
@Columns nvarchar(max),
@Columns_ nvarchar(max),
@ColumnName nvarchar(max),
@SQLColumns nvarchar(max),
@SQLQuery nvarchar(max),
@SQLString nvarchar(max),
@LastRecord int,
@StartPos int,
@sfrechette
sfrechette / AsterixGraphGist
Last active December 20, 2015 23:09
partoutatis - Astérix GraphGist
== Astérix - Les personnages
=== Asterix the Gaul - Characters
by [@sfrechette] (https://twitter.com/sfrechette)
This is a sample subset for you to explore. +
For the complete model (Cypher Query) and Graph Database with all characters, nodes and relationships: +
https://github.com/neo4j-contrib/graphgist/wiki/Asterix-Dataset
Source data: http://www.asterix.com/asterix-de-a-a-z/les-personnages/ +