Skip to content

Instantly share code, notes, and snippets.

View SebastianGaud's full-sized avatar

Sebastiano SebastianGaud

  • Italy, Forlì FC
View GitHub Profile
@SebastianGaud
SebastianGaud / ClassGenerator.sql
Created November 28, 2019 14:09 — forked from ernado-x/ClassGenerator.sql
Generate C# class from database table
--from SO: http://stackoverflow.com/questions/5873170/generate-class-from-database-table
declare @TableName sysname = 'TableName'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
<style>
.strike {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
}
.strike > span {
position: relative;
@SebastianGaud
SebastianGaud / date.getWeek.js
Created February 7, 2019 13:22
javascript, js, getWeek
/**
* Returns the week number for this date. dowOffset is the day of week the week
* "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday),
* the week returned is the ISO 8601 week number.
* @param int dowOffset
* @return int
*/
Date.prototype.getWeek = function (dowOffset) {
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
@SebastianGaud
SebastianGaud / JS-LINQ.js
Created July 13, 2018 08:32 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@SebastianGaud
SebastianGaud / github-markdown-print.js
Created June 22, 2018 08:17 — forked from hangxingliu/github-markdown-print.js
GitHub Markdown Print Script
// Refrence from: https://gist.github.com/beevelop/a0f2c76e79610dca01550c9a93f83876
// Copy following scripts in the developer console of page included markdown content you want to print:
(function () {
var $ = document.querySelector.bind(document);
$('#readme').setAttribute('style', 'position:absolute;top:0;left:0;right:0;bottom:0;z-index:100;background-color:white');
$('#readme>article').setAttribute('style', 'border: none');
$('body').innerHTML = $('#readme').outerHTML;
window.print();
})();
# This file has been written to your home directory for convenience. It is
# saved as "/home/pi/temperature-2017-10-12-13-53-36.py"
import time
import threading
import csv
import datetime
from sense_emu import SenseHat
brake = 1
@SebastianGaud
SebastianGaud / SendTelegramMessageWithGetUpdates.cs
Created May 10, 2017 22:23
Retrieve Chat Id from getUpdates and send a Message to the first recipient
public static void Main(string[] args)
{
List<Result> result = MakeRequest().Result;
SendMessage(result);
Console.Read();
}
public static async void SendMessage(List<Result> result)
@SebastianGaud
SebastianGaud / SendEmail.cs
Created April 16, 2017 11:47
Send Email in C# through google
public static void CreateTestMessage4 ( string server )
{
MailAddress from = new MailAddress( "senderemail" );
MailAddress to = new MailAddress( "recipientemail" );
MailMessage message = new MailMessage( from , to );
System.Net.Mail.Attachment attachment = new System.Net.Mail.Attachment( Environment.CurrentDirectory + "/file.pdf" );
var smtp = new SmtpClient