Skip to content

Instantly share code, notes, and snippets.

@philoushka
philoushka / azure_let's_encrypt.md
Last active March 11, 2019 21:47
Azure and Let's Encrypt
  1. get manual files at sslforfree.com
  2. edit the TXT entries at Namecheap
  3. download the certs that sslforfree.com gives you
  4. convert the crt file to pfx - open Mac Terminal, and cd to the directory that you downloaded them to.
  5. openssl pkcs12 -export -out myVipSiteName-CurrentMonth-CurrentYear.pfx -inkey private.key -in certificate.crt
  6. enter a pwd
  7. upload to Azure portal.
  8. MAKE NOTE OF THE NEW CERT'S THUMBPRINT
  9. change bindings in Azure
  10. delete the old cert in Azure
@philoushka
philoushka / Canada-provinces.sql
Last active August 24, 2017 13:35
SQL script to create Canadian provinces
declare @CountryID int;
select @CountryID = ID
from Country
where CountryCode = 'CA';
--load up this country with its states
insert into [State] (CountryID, [Name], Abbr, UtcOffset) values
(@CountryID, 'Alberta', 'AB',-7)
, (@CountryID, 'British Columbia', 'BC',-8)
@philoushka
philoushka / Mexican-states.sql
Last active August 6, 2019 03:08
SQL script to create Mexican States
declare @CountryID int;
select @CountryID = ID
from Country
where Abbr = 'MEX'
--load up this country with its states
insert into [State] (CountryID, [Name], Abbr) values (@CountryID, 'Aguascalientes', 'AGU');
insert into [State] (CountryID, [Name], Abbr) values (@CountryID, 'Baja California', 'BCN');
insert into [State] (CountryID, [Name], Abbr) values (@CountryID, 'Baja California Sur', 'BCS');
@philoushka
philoushka / USA-states.sql
Last active August 24, 2017 13:43
SQL script to create American/USA states
declare @CountryID int;
select @CountryID = ID
from Country
where CountryCode = 'US';
--load up this country with its states
insert into [State] (CountryID, [Name], Abbr, UtcOffset) values
--load up this country with its states
@philoushka
philoushka / install-service.ps1
Created July 7, 2015 23:03
Install a Windows Service
$serviceName = "My Service Name"
$exePath = "C:\Program Files\foo\bar.exe"
$username = "someUser"
$password = convertto-securestring -String "somePassword" -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$existingService = Get-WmiObject -Class Win32_Service -Filter "Name='$serviceName'"
if ($existingService)
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication1
{
public class Program
{
public static void Main()
{
string contents = "Foo=\" \" OrderDate=\"1/9/2014 6:30:03 AM\" OrderNumber=\"090181809\" OrderAmount=\"50404.04\" BillTo=\"Customer Foo\" BillToAddr1=\"123 BAR DRIVE\" BillToAddr2=\"PO BOX 111\" BillToAddr3=\"\" BillToCity=\"NEW YORK\" BillToState=\"NY\" BillToPostalCode=\"42002\" BillToCntry=\"US\" BillToLat=\"39.99\" BillToLong=\"-34.73\" ShipTo=\"BAR\" ShipToAddr1=\"123 BAR LANE\" ShipDate=\"1/9/2015\" ForeignDuty=\"True\" MixNuts=\"False\" ";
using System;
using System.Web;
public class Cookies
{
private const string ApplicationName = "MyCoolApplication";
private enum CookieItem
{
UserGuid,
@philoushka
philoushka / move-all-tables-procs-new-schema.sql
Last active August 29, 2015 14:22
move/transfer all tables, stored proces, and functions to another SQL Server schema
declare @newSchema varchar(100) = 'newSchema',
@currentSchema varchar(100) = 'dbo';
--tables and views
select 'alter schema ' + @newSchema + ' transfer ' + TABLE_SCHEMA + '.[' + TABLE_NAME + ']'
from information_schema.TABLES where TABLE_SCHEMA = @currentSchema
union
--stored procs and functions
select 'alter schema ' + @newSchema + ' transfer ' + ROUTINE_SCHEMA + '.[' + ROUTINE_NAME + ']'
from information_schema.routines
@philoushka
philoushka / logon.ps1
Created April 15, 2015 18:35
Windows Logon Script
#disable Chrome's pwd manager
$chromeRegKey = "HKCU:\SOFTWARE\Policies\Google\Chrome"
Set-ItemProperty -Path $chromeRegKey -Name PasswordManagerEnabled -Value 0
# set home button URL
Set-ItemProperty -Path $chromeRegKey -Name HomepageLocation -Value "http://www.trello.com"
#set your start URLs
$chromeUrlsKey = "$ChromeRegKey\RestoreOnStartupURLs"
$startUrls =
@philoushka
philoushka / overrideChromeSettings.ps1
Created April 14, 2015 17:59
Override Chrome settings locked by Group Policy
#disable Chrome's pwd manager
$regKey = "HKCU:\SOFTWARE\Policies\Google\Chrome"
Set-ItemProperty -Path $regKey -Name PasswordManagerEnabled -Value 0
#set your start URLs
$regKey = "HKCU:\SOFTWARE\Policies\Google\Chrome\RestoreOnStartupURLs"
$startUrls =
"https://tweetdeck.twitter.com",
"https://trello.com",
"https://github.com"