Skip to content

Instantly share code, notes, and snippets.

View thepirat000's full-sized avatar
💗
In love with code

Federico Daniel Colombo thepirat000

💗
In love with code
View GitHub Profile
# Install sber-swap pre-requisites for Windows 10 on an Azure VM of type NC (GPU)
# NVIDIA TeslaK80 / Radeon
Set-ExecutionPolicy Bypass -Scope Process -Force;
# Install chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
refreshenv
@mgeeky
mgeeky / Enumerate-URIHandlers.ps1
Created January 12, 2022 12:24
Enumerate Windows URI Handlers (Keys in HKEY_CLASSES_ROOT that contain "URL Protocol" values), examples: http:, calculator:, ms-officecmd:
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue | Out-Null
$count = 0
try {
Get-ChildItem HKCR: -ErrorAction SilentlyContinue | ForEach-Object {
if((Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue).PSObject.Properties.Name -contains "URL Protocol") {
$name = $_.PSChildName
$count += 1
$line = "URI Handler {0:d4}: {1}" -f $count, $name
Write-Host $line
}
internal class MongoTracking
{
private readonly Action<CommandStartedEvent> onCommandStartEvent;
private readonly Action<CommandSucceededEvent> onCommandSucceededEvent;
private readonly Action<CommandFailedEvent> onCommandFailedEvent;
private IEnumerable<string> NotTrackedCommands { get; } = new[]
{"isMaster", "buildInfo", "getLastError", "saslStart", "saslContinue"};
@YuxiUx
YuxiUx / midi-note-to-freq.md
Last active May 20, 2023 07:09
How to convert midi note to frequency in C, C++, Python, JS and PHP

JS

function noteToFreq(note) {
    let a = 440; //frequency of A (coomon value is 440Hz)
    return (a / 32) * (2 ** ((note - 9) / 12));
}

PHP

function noteToFreq($note) {
@antirez
antirez / api.md
Last active November 20, 2018 02:52
Consumer groups final API
  • XGROUP CREATE <key> <groupname> <id or $>
  • XGROUP SETID <key> <id or $>
  • XGROUP DELGROUP <key> <groupname>
  • XGROUP DELCONSUMER <key> <consumername>
  • XPENDING <key> [<start> <stop>]
  • XCLAIM <key> <group-name> <consumer-name> <min-idle-time> <ID-1> <ID-2> ...
  • XACK <key> <ID-1> <ID-2> ...
  • XREAD-GROUP (wrapper for XREAD that accepts GROUP and CONSUMER options)
  • XINFO [CONSUMERS|GROUPS|STREAM|...]. STREAM is the default
@gaearon
gaearon / connect.js
Last active November 14, 2024 08:35
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@PeteGoo
PeteGoo / Send-UdpDatagram.ps1
Last active November 6, 2024 15:22
Sending UDP datagrams in powershell
function Send-UdpDatagram
{
Param ([string] $EndPoint,
[int] $Port,
[string] $Message)
$IP = [System.Net.Dns]::GetHostAddresses($EndPoint)
$Address = [System.Net.IPAddress]::Parse($IP)
$EndPoints = New-Object System.Net.IPEndPoint($Address, $Port)
$Socket = New-Object System.Net.Sockets.UDPClient
@antirez
antirez / wh.md
Last active November 26, 2020 07:18
For white hat hackers setting passwords to open Redis instances

Dear white hat attackers,

recently we observed a number of Redis instances that were targeted by a simple attack, consisting in setting a password using the CONFIG SET requirepass <password> command to instances which are left open on the internet.

This is, in my opinion, a good idea, since those Redis instances are going to be cracked anyway. I believe you are doing this in order to make Redis users aware they forgot to setup firewalling rules in order to make their instances not reachable from the outside.

function Update-AssemblyInfoVersionFiles
{
Param
(
[Parameter(Mandatory=$true)]
[string]$productVersion
)
$buildNumber = $env:BUILD_BUILDNUMBER
if ($buildNumber -eq $null)
@graydon
graydon / country-bounding-boxes.py
Created April 23, 2014 00:03
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),