Skip to content

Instantly share code, notes, and snippets.

Avatar
😱
coding hard

giammin giammin

😱
coding hard
View GitHub Profile
@giammin
giammin / LogPublicIp.py
Created Oct 26, 2020
python script to log public ip changes
View LogPublicIp.py
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = 'ip.log'
URL = 'https://ipinfo.io/ip'
try:
@giammin
giammin / program.cs
Created Nov 12, 2019
test Task.WaitAll Task.WhenAll Awaiting multiple Tasks with different results Getting return values from Task.WhenAll
View program.cs
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace TestWhenAll.Console
{
public class Program
{
public static void Main(string[] args) => MainAsync(args).GetAwaiter().GetResult();
@giammin
giammin / missing.sql
Created Jun 12, 2019
index sql server script, missing and unused
View missing.sql
-- Missing Index Script
-- Original Author: Pinal Dave
-- https://blog.sqlauthority.com/2011/01/03/sql-server-2008-missing-index-script-download/
SELECT TOP 25
dm_mid.database_id AS DatabaseID,
dm_migs.avg_user_impact*(dm_migs.user_seeks+dm_migs.user_scans) Avg_Estimated_Impact,
dm_migs.last_user_seek AS Last_User_Seek,
OBJECT_NAME(dm_mid.OBJECT_ID,dm_mid.database_id) AS [TableName],
'CREATE INDEX [IX_' + OBJECT_NAME(dm_mid.OBJECT_ID,dm_mid.database_id) + '_'
+ REPLACE(REPLACE(REPLACE(ISNULL(dm_mid.equality_columns,''),', ','_'),'[',''),']','')
@giammin
giammin / Pok3r.ahk
Last active Jul 12, 2016 — forked from JarvisPrestidge/Pok3r.ahk
Personal AutoHotKey script that turns any keyboard into a Pok3r.
View Pok3r.ahk
#CommentFlag //
#InstallKeybdHook
// Author: Jarvis Prestidge
// Description: Simulates my preferred keyboard layout, similiar to that of the Pok3r 60% keyboard
// on any keyboard without programmable keys. i.e. my laptop ^^
// <COMPILER: v1.1.22.00>
@giammin
giammin / birthday.sql
Created May 31, 2016
calculate day before birthday
View birthday.sql
DECLARE @birthday datetime;
set @birthday='1916-02-29T11:35:42.710';
DECLARE @today datetime;
set @today='2015-03-01T11:35:42.710';
declare @calc datetime;
set @calc=DAteadd(day,-1,DATEADD(year,year(@today)-YEAR(@birthday),@birthday));
select @today as today,@birthday as birthday, @calc as calc, iif(CONVERT(date, @today)=CONVERT(date, @calc),1,0)
@giammin
giammin / Autoclose.sql
Last active Dec 3, 2015
Sql Server Query collection
View Autoclose.sql
--check and set auto_close
ALTER DATABASE [dbname] SET AUTO_CLOSE Off WITH NO_WAIT;
SELECT DATABASEPROPERTYEX('dbname', 'IsAutoClose');
EXEC sp_MSforeachdb 'ALTER DATABASE [?] SET AUTO_CLOSE Off WITH NO_WAIT'
You can’t perform that action at this time.