USE master;
GO
DECLARE @nvcmaxVariable nvarchar(max);
SET @nvcmaxVariable = CONVERT(nvarchar(max), N'ಠ russian anomaly ЯЁЪ ಠ ') + N'something else' + N'another';
SELECT @nvcmaxVariable;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DayDis, | |
[1990], [1991], [1992], [1993], [1994], [1995], [1996], [1997], [1998], [1999], [2000], [2001], [2002], [2003], [2004], [2005], [2006], [2007], [2008], [2009], [2010], [2011], [2012], [2013], [2014], [2015], [2016], [2017], [2018], [2019], [2020] | |
FROM | |
( | |
SELECT YEAR([Date]) AS DateYear | |
, CASE WHEN MONTH([Date]) < 10 THEN ('0' + CAST(MONTH([Date]) AS VARCHAR)) | |
ELSE CAST(MONTH([Date]) AS VARCHAR) | |
END + '.' + | |
CASE WHEN DAY([Date]) < 10 THEN ('0' + CAST(DAY([Date]) AS VARCHAR)) | |
ELSE CAST(DAY([Date]) AS VARCHAR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ArchiveItems { | |
param([Parameter(Mandatory)][string]$Archive) | |
function recurse-items { | |
param([object]$items) | |
foreach($item in $items) { | |
$item | |
$folder = $item.GetFolder | |
if ($folder) { | |
recurse-items $folder.Items() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get Max ID from table | |
SELECT MAX(id) FROM table; | |
-- Get Next ID from table | |
SELECT nextval('table_id_seq'); | |
-- Set Next ID Value to MAX ID | |
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Adrian Sullivan - 2019/11/15 Fun with polygons. */ | |
/* Thanks to Michael J Swart for all the awesome work on color https://michaeljswart.com/ */ | |
DECLARE @tt table(id int identity(0,1), label varchar(50), gg geometry); | |
SET NOCOUNT ON; | |
DECLARE @g geometry = 'POLYGON((-121.97087 37.372518,-121.97087 37.372518,-121.970863 37.372517,-121.970845 37.372515,-121.97087 37.372518))'; | |
DECLARE @i int = 1; | |
WHILE @i <= 450 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Compare Excel Sheeets | |
Inspired by https://pbpython.com/excel-diff-pandas-update.html | |
""" | |
import argparse | |
import pandas as pd | |
import numpy as np |
- First download
dbfpy
: http://sourceforge.net/projects/dbfpy/files/latest/download?source=files - Then install:
sudo python setup.py install
To convert DBF file to CSV:
./dbf2csv database.dbf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://dba.meta.stackexchange.com/revisions/3e578461-07e9-46f2-b81d-a5f3e582171a/view-source | |
Set-Location ~/repos/git/SQL-Server-First-Responder-Kit | |
# https://stackoverflow.com/a/43737097/4709762 | |
# $regexUrl='(http[s]?)(:\/\/)([^\s,]+)(?=")' | |
# https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url | |
$regexUrl = 'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import-module poshrsjob; | |
$DownloadDir = "/users/andy/Downloads/poshrsjob"; | |
$MaxJobs = 3; | |
foreach ($i in 1..24) { | |
Start-RSJob -Throttle $MaxJobs -Batch "Demo" -argumentlist $i, $DownloadDir -ScriptBlock { | |
param($JobNum, $OutputDir) | |
$OutputFile = Join-Path -Path $OutputDir -ChildPath "RSJob$JobNum.zip"; | |
Start-Sleep -Seconds (get-random -Minimum 1 -Maximum 15); | |
Invoke-WebRequest -uri "https://github.com/proxb/PoshRSJob/archive/master.zip" -OutFile $OutputFile; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jeremie Miserez <[email protected]>, 2015 | |
// | |
// A little bit of Javascript to let you export your Google Music library, playlists, and album track lists :) | |
// | |
// I posted this as an answer here: http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music | |
// | |
// 1. Go to: https://play.google.com/music/listen#/all (or your playlist) | |
// | |
// 2. Open a developer console (F12 for Chrome). Paste | |
// code below into the console. |