Skip to content

Instantly share code, notes, and snippets.

@Marshall-Hallenbeck
Marshall-Hallenbeck / StopEvaluationShutdown.ps1
Last active May 5, 2024 15:30
Prevent Automatic Shutdown for Expired Windows Evaluation VMs
# Create PS folder on C: drive
New-Item -ItemType Directory -Force -Path "C:\PS"
# Set TLS versions for download (it will error otherwise)
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
# Download PsTools
Invoke-WebRequest -Uri "https://download.sysinternals.com/files/PSTools.zip" -OutFile "C:\PS\PSTools.zip"
# Extract PsTools to the PS folder
Expand-Archive -Path "C:\PS\PSTools.zip" -DestinationPath "C:\PS"
# Auto Accept EULA, can also run psexec with -accepteula
#reg ADD HKCU\Software\Sysinternals\PSexec /v EulaAccepted /t REG_DWORD /d 1 /f
@vorozhba
vorozhba / Как удалить commit в Github.txt
Last active May 5, 2024 15:29
Как удалить commit в Github
1. Получаем хэш-код коммита, к которому хотим вернуться.
2. Заходим в папку репозитория и пишем в консоль:
$ git reset --hard a3775a5485af0af20375cedf46112db5f813322a
$ git push --force
@mattifestation
mattifestation / AMSIScriptContentRetrieval.ps1
Created June 18, 2018 00:47
PoC code used to demonstrate extracting script contents using the AMSI ETW provider
# Script author: Matt Graeber (@mattifestation)
# logman start AMSITrace -p Microsoft-Antimalware-Scan-Interface Event1 -o AMSITrace.etl -ets
# Do your malicious things here that would be logged by AMSI
# logman stop AMSITrace -ets
$OSArchProperty = Get-CimInstance -ClassName Win32_OperatingSystem -Property OSArchitecture
$OSArch = $OSArchProperty.OSArchitecture
$OSPointerSize = 32
if ($OSArch -eq '64-bit') { $OSPointerSize = 64 }
@croian
croian / macKeyRemapGuide.md
Last active May 5, 2024 15:26
A Complete Guide to Customizing Mac Keyboard Shortcuts

A Complete Guide to Customizing Mac Keyboard Shortcuts

To help make Mac keyboard shortcuts more like Windows/Linux, and/or just customize them to your liking and boost your productivity.

The instructions here worked for me on macOS Ventura 13.4.1 (22F82) and with Karabiner-Elements (where applicable) version 14.12.0.

This is the standard version of the guide, meant to be easy to use/understand by non-advanced users, and explicit/complete in its instructions. For a more terse guide / reference see the condensed version.

A Note on Command and Control

@ohaval
ohaval / sort_five_elements_seven_comparisons.py
Created May 5, 2024 08:34
An implementation of the Ford-Johnson Algorithm for a 5 integer list in Python, which sorts in 7 comparisons only
"""As part of the 'Data Structures and Introduction to Algorithms' course, I was asked to solve the following problem:
Write a function that sorts five elements in seven comparisons in the worst case.
As I found this problem interesting, I decided to implement it in Python. For better understanding, I recommend
reading the answer from the link below, which explains the algorithm.
"""
import random
from typing import List
@FranklinYu
FranklinYu / README.markdown
Last active May 5, 2024 15:24
links for old versions of Docker for Mac (inspired by docker/for-mac#1120)

links for old versions of Docker for Mac

Deprecated

Docker provides download links in release note. They promised that

(we) will also include download links in release notes for future releases.

Note:

@LukeMathWalker
LukeMathWalker / audit.yml
Last active May 5, 2024 15:23
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@dangtrinhnt
dangtrinhnt / clean_comments.sh
Last active May 5, 2024 15:19
Delete all pending comment using WP-CLI
#! /bin/bash
for blog_path in $(wp site list --field=path)
do
path_wo_slashes="${blog_path////""}"
url="http://your.blog.address/$path_wo_slashes"
# status = approve, hold, trash, spam
tmp_ids=$(wp comment list --status=hold --format=ids --url=$url)
# clean the string
pending_ids="$(echo -e "${tmp_ids}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
@voidfiles
voidfiles / posterouss_bookmarklet.js
Created June 2, 2012 22:31
Posterous's Bookmarklet
// Bookmarklet
javascript: var % 20b = document.body;
var % 20POSTEROUS___bookmarklet_domain = 'http://posterous.com';
var % 20d = new % 20Date();
var % 20e = (new % 20Date(d.getFullYear(), d.getMonth(), d.getDate())).getTime();
if (b && !document.xmlVersion) {
void(z = document.createElement('script'));
void(z.type = 'text/javascript');
void(z.src = 'http://posterous.com/javascripts/bookmarklet2.js?' + e);
void(b.appendChild(z));
@axel-op
axel-op / dart-github-actions.md
Last active May 5, 2024 15:17
3 ways to build a GitHub Action with Dart

3 ways to build a GitHub Action with Dart

In 2020, I published the Pub package github_actions_toolkit to write GitHub Actions with Dart more easily. However, GitHub Actions runners don't support natively the Dart language, and some steps are necessary to execute a Dart program in a GitHub Actions workflow.

Below I compare three ways to create a GitHub Action with Dart, with their pros and cons.

. Shared Dart container Isolated Dart container Natively compiled executable
✍️ Defines the environment User Developer Developer