Skip to content

Instantly share code, notes, and snippets.

@metaskills
metaskills / gist:893599
Created March 29, 2011 23:54
A Copy Of sp_MSforeachtable Stored Procedure For Azure, Uses sp_MSforeach_worker
CREATE proc [dbo].[sp_MSforeachtable]
@command1 nvarchar(2000), @replacechar nchar(1) = N'?', @command2 nvarchar(2000) = null,
@command3 nvarchar(2000) = null, @whereand nvarchar(2000) = null,
@precommand nvarchar(2000) = null, @postcommand nvarchar(2000) = null
AS
declare @mscat nvarchar(12)
select @mscat = ltrim(str(convert(int, 0x0002)))
if (@precommand is not null)
exec(@precommand)
@unitycoder
unitycoder / if-branchless.shader
Last active March 29, 2024 11:27
Avoiding Branching / Conditionals in Shaders Fast No If
"The common wisdom of "don't use conditionals in shaders" is one of my biggest frustrations with how shaders are taught.
step(y, x) _is_ a conditional! It compiles to identical code as:
float val = (x >= y ? 1.0 : 0.0)
or
float val = 0.0;
if (x >= y) val = 1.0;"
https://twitter.com/bgolus/status/1235254923819802626
// Performing shader divisions without diving *rcp = approximation of 1/x
float myDividedVal = myValToDivide * rcp(myDivider);
@rms1000watt
rms1000watt / python-printJS-in-pdf.py
Last active March 29, 2024 11:24
Python script to add JS to pdf so the pdf will print immediately when opened
# IE users need: https://get.adobe.com/reader/
from PyPDF2 import PdfFileWriter, PdfFileReader
output = PdfFileWriter()
ipdf = PdfFileReader(open('old.pdf', 'rb'))
for i in xrange(ipdf.getNumPages()):
page = ipdf.getPage(i)
output.addPage(page)
@Kartones
Kartones / postgres-cheatsheet.md
Last active March 29, 2024 11:23
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@SoabY
SoabY / JetBrains products Activation code until 15 May 2024
Created October 1, 2023 08:04
JetBrains products Activation code until 15 May 2024
8Z6IT0PIZH-eyJsaWNlbnNlSWQiOiI4WjZJVD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els Business Activation Key
Parallels Business Activation Key
6YDASE-890T7S-E5YFS6-54F6YW-4780JY
390349-032409-342340-932902-390693
@bdcravens
bdcravens / add-timestamps.sql
Created December 19, 2012 21:32
SQL Server - add createdAt and updatedAt columns, automatically updates
ALTER TABLE myTable
add createdAt datetime
CONSTRAINT DF_myTable_createdat DEFAULT GETDATE()
ALTER TABLE myTable
add updatedAt datetime
CONSTRAINT DF_myTable_updatedAt DEFAULT GETDATE()
go
@terickson001
terickson001 / main.odin
Last active March 29, 2024 11:16
vulkan-tutorial example in Odin
import "shared:shaderc"
import "vendor:glfw"
import vk "vendor:vulkan"
MAX_FRAMES_IN_FLIGHT :: 2
Context :: struct
{
instance: vk.Instance,