Instantly share code, notes, and snippets.

View Meta Check
error: while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/.gc-of-borg-outpaths.nix:39:12, called from undefined position:
while evaluating anonymous function at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:6, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/attrsets.nix:283:43:
while evaluating 'hydraJob' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:157:14, called from /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/pkgs/top-level/release-lib.nix:121:14:
while evaluating the attribute 'name' at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/eval-1-lassulus.ewr1.nix.ci/lib/customisation.nix:162:24:
while evaluating the attribut
View setupJest.js
jest.mock("CameraRoll", () => ({
getPhotos: jest
.fn()
.mockImplementation(() => Promise.resolve({ edges: [], page_info: {} })),
saveToCameraRoll: jest
.fn()
.mockImplementation(() => Promise.resolve("protocol://the-new-uri"))
}));
View execute_code_if_user.php
$iam = 'username';
$current_user = wp_get_current_user();
if ( $current_user->exists() ) {
if($current_user->user_login === $iam) {
do_something();
}
}
function do_something(){
/* Your code here */
}
View 100_guess.json
[{"k": 1, "accuracy": 0.305233, "method": "educated guess"},
{"k": 2, "accuracy": 0.601744, "method": "educated guess"},
{"k": 3, "accuracy": 0.796512, "method": "educated guess"},
{"k": 4, "accuracy": 0.886628, "method": "educated guess"},
{"k": 5, "accuracy": 0.927326, "method": "educated guess"},
{"k": 6, "accuracy": 0.991279, "method": "educated guess"},
{"k": 7, "accuracy": 1.000000, "method": "educated guess"},
{"k": 1, "accuracy": 0.127907, "method": "uniform random guess"},
{"k": 2, "accuracy": 0.284884, "method": "uniform random guess"},
{"k": 3, "accuracy": 0.430233, "method": "uniform random guess"},
View electron-fem-v2.md

You'll need a recent version of Node.js installed on your computer with administrative access. Yarn is not required, but Electron Forge uses it, so it would be helpful to install beforehand.

Please make sure you're using a supported platform. This is particularly important if you're running Linux.

Important note: If you're using Windows, make sure you're not using the Windows Subsystem for Linux. This will confuse Electron to thinking you're running on a Linux machine when you're really not.

We'll be using working through the following repositories over the course of the workshop:

View Active Get-DecryptedCpassword
function Get-DecryptedCpassword {
[CmdletBinding()]
Param (
[string] $Cpassword
)
try {
#Append appropriate padding based on string length
$Mod = ($Cpassword.length % 4)
View functions.php
<?php
// Source: https://www.wpbeginner.com/wp-tutorials/automatically-remove-default-image-links-wordpress/
// functions.php
function wpb_imagelink_setup() {
$image_set = get_option( 'image_default_link_type' );
if ($image_set !== 'none') {
update_option('image_default_link_type', 'none');
}
View pascal_triangle.js
function createPascalTriangle (numRows) {
var pascalTriangle = []
for (var i = 0; i < numRows; i++) {
pascalTriangle[i] = new Array(i+1)
for (var j = 0; j < i+1; j++) {
if (j === 0 || j === i) {
pascalTriangle[i][j] = 1
} else {
View CorruptCLRGlobal.ps1
function Subvert-CLRAntiMalware {
<#
.SYNOPSIS
A proof-of-concept demonstrating overwriting a global variable that stores a pointer to an antimalware scan interface context structure. This PoC was only built to work with .NET Framework Early Access build 3694.
.DESCRIPTION
clr.dll in .NET Framework Early Access build 3694 has a global variable that stores a pointer to an antimalware scan interface context structure. By reading the pointer at that offset and then overwriting the forst DWORD, the context structure will become corrupted and subsequent scanning calls will fail open.
View core-blocks-list-cpt-register.php
<?php
[...]
'template' =>
array(
array('core/archives'),
array('core/audio'),
array('core/block'),
array('core/button'),
array('core/categories'),