Skip to content

Instantly share code, notes, and snippets.

View jmelosegui's full-sized avatar

Juan Manuel Elosegui jmelosegui

View GitHub Profile
@FlogDonkey
FlogDonkey / Move TempDB.sql
Last active April 9, 2024 12:20
New and improved Move TempDB script. Captures xp_cmdshell value before execution and resets it post-execution. Allows for dynamic drive allocation in case of company policy of leaving some set percent of drive available for future growth. Also includes improved error handling and validation, as well as a @debug mode, allowing us to run the scrip…
/*
Snippet is nuts and bolts for creating/moving to an isolated tempdb drive.
After you run this, SQL Server must be restarted for it to take effect
*/
DECLARE @DriveSizeGB INT = 40
,@FileCount INT = 9
,@InstanceCount TINYINT = 1
,@VolumeBuffer DECIMAL(8, 2) = .8 /* Set to amount of volume TempDB can fill. */
,@RowID INT
,@FileSize VARCHAR(10)
@NickCraver
NickCraver / Craver-Paradox.ps1
Last active April 20, 2022 03:05
My PowerShell PoshGit theme (used with Cmder)
#requires -Version 2 -Modules posh-git
# This is a tweaked version of https://github.com/JanJoris/oh-my-posh/blob/master/Themes/Paradox.psm1
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@PlagueHO
PlagueHO / Install-AzureContainerInstancePersistStorage.ps1
Last active August 17, 2020 16:29
Install an Azure Container Instance with a Linux Container that requires persistent storage (for example GoCD-Server)
[CmdletBinding()]
param
(
[Parameter(Mandatory = $True)]
[String] $ServicePrincipalUsername,
[Parameter(Mandatory = $True)]
[SecureString] $ServicePrincipalPassword,
[Parameter(Mandatory = $True)]
@AArnott
AArnott / ThrottleDemo.cs
Last active March 1, 2021 21:28
Demonstrates scheduling unbounded work and applying a throttle to keep the threadpool responsive.
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("*** WITHOUT throttling ***");
@domwrap
domwrap / Google Music All Access Family Plan for G-Suite GMail Vanity Domains.md
Last active August 24, 2023 02:26
Google Music All Access Family Plan for G-Suite / GMail Vanity Domains

Google Music All Access Family Plan for G-Suite / GMail Vanity Domains

Synopsis

I had wondered about this some weeks ago before finally trying it out today. I'm surprised nobody else had tried already. I was successful enough to be satisfied for my own uses. YMMV.

Result is I have a new Play Music account with Family Sharing which I can share with my G-Suite users, with all my playlists* moved over, and without anyone needing to maintain a separate email account.

This whole process took me about an hour, including moving across 15 playlists, but not including MX record propagation.

@g0t4
g0t4 / Notes.md
Last active November 4, 2024 06:15
Getting Started with Docker on Windows
@NickCraver
NickCraver / ExampleUsage.cs
Last active October 16, 2024 02:37
Code to mark a SQL string before it's passed to Dapper.
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
@kylebrandt
kylebrandt / Backup Cronjob
Created May 20, 2016 16:31
Redis Config, Version, Backup for Stack Overflow's Bosun Instance
0 * * * * cp -a /var/lib/redis/bosun-redis.rdb '/mnt/bosun_backup/bosun_redis_'$(date +\%Y-\%m-\%d-\%H).rdb && find '/mnt/bosun_backup/' -maxdepth 1 -name 'bosun_*.rdb' -ctime '+2' -delete
## Hmpf, ctime makes no since, just noticed, but whatever.
@SteveSanderson
SteveSanderson / somefile.cs
Last active May 11, 2016 23:56
Async void message loop
public class MyNetworkClient {
public async Task ConnectAsync(string address) {
await this.MakeTheActualConnection(address);
this.BeginReceiveLoop();
}
// It's async void! But is that bad?
// I know that an unhandled exception here is going to bring down the process, but where else do you want
// that exception to go? There's no external control flow that can reasonably receive such an exception.
private async void BeginReceiveLoop() {
@ivandrofly
ivandrofly / Unicode table
Created May 4, 2014 02:20
Unicode table - List of most common Unicode characters *
Unicode table - List of most common Unicode characters *
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable.
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol.
What is Unicode?
Unicode is a standard created to define letters of all languages ​​and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode.
How to identify the Unicode number for a character?
Type or paste a character: