Skip to content

Instantly share code, notes, and snippets.

@p3x-robot
p3x-robot / ntfs-file-system-increase-speed-performance.com
Last active May 15, 2024 14:02
🚄 This is a simple utility to increase the NTFS performance by turning off some NTFS features that are not so used by now (or not so important).
rem execute as an Administrator
rem based on http://www.windowsdevcenter.com/pub/a/windows/2005/02/08/NTFS_Hacks.html
ram based on https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc938961(v=technet.10)
rem http://archive.oreilly.com/cs/user/view/cs_msg/95219 (some installers need 8dot3 filenames)
rem disable 8dot3 filenames
ram Warning: Some applications such as incremental backup utilities rely on this update information and do not function correctly without it.
fsutil behavior set disable8dot3 1
@Stuart-Moore
Stuart-Moore / ParallelHeaderScan.ps1
Created November 25, 2017 21:57
Parallel Header scans on single server
Import-Module poshrsjob
$folders = ('C:\dbatools\RestoreTimeClean','C:\dbatools\RestoreTimeDiffDemo','c:\dbatools\restoretimeDiff')
$job = $Folders | Start-RsJob -ModulesToImport dbatools -ScriptBlock {
param($Folder)
Get-DbaBackupInformation -SqlInstance localhost\SqlExpress2016 -Path $Folder
}
$job | Wait-RsJob -ShowProgress
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active April 24, 2024 18:22
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@kspeeckaert
kspeeckaert / sqlserver_tracefiles.py
Created March 14, 2016 14:32
Read SQL server deadlock tracefile (exported to XML format) in Python and convert it to Pandas
import timeit
from lxml import etree
from pandas import DataFrame
from uuid import uuid4
# List of process attributes to retrieve
def analyze_deadlock(elem, data_locks, data_procs):
# Generate a UUID to identify all processes belonging to the same deadlock event
dl_uuid = uuid4().hex
databases = set()
@jdhitsolutions
jdhitsolutions / Get-LocalGroupMember.ps1
Last active December 13, 2022 23:13
A PowerShell function to list members of a local group such as Administrators.
#requires -version 4.0
Function Get-LocalGroupMember {
<#
.SYNOPSIS
Get local group membership using ADSI.
.DESCRIPTION
This command uses ADSI to connect to a server and enumerate the members of a local group. By default it will retrieve members of the local Administrators group.
@deiu
deiu / webcryptoapi.html
Last active January 7, 2024 21:18
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
package whoop.whoop
import java.util.concurrent.TimeUnit
import org.openjdk.jmh.annotations._
import scala.util.control.NoStackTrace
@State(Scope.Benchmark)
@BenchmarkMode(Array(Mode.AverageTime))
@jberkus
jberkus / gist:6b1bcaf7724dfc2a54f3
Last active January 7, 2024 21:26
Finding Unused Indexes
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@jrudolph
jrudolph / analysis.txt
Last active May 21, 2019 12:42
Scala 2.11 Release Train
TargetVersion: Scala 2.11 LastVersion: Scala 2.10
86 libraries available for Scala 2.11 (see the end for sbt config lines)
akka-actor 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more]
akka-stream 57 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [52 more]
akka-http-core 51 versions: 3.0.0-RC1, 2.4.9, 2.4.9-RC2, 2.4.9-RC1, 2.4.8, ... [46 more]
akka-http 29 versions: 3.0.0-RC1, 10.1.8, 10.1.7, 10.1.6, 10.1.5, ... [24 more]
akka-osgi 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more]
akka-slf4j 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more]
akka-testkit 80 versions: 2.5.9, 2.5.8, 2.5.7, 2.5.6, 2.5.5, ... [75 more]
@tylerjl
tylerjl / hashmark.rb
Created April 16, 2014 03:19
Hashmark v1.0
#!/usr/bin/env ruby
require 'digest/sha1'
require 'digest/sha3'
require 'digest/md5'
require 'bcrypt'
require 'securerandom'
require 'benchmark'
require 'pp'
require 'json'