Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@jpremji
jpremji / gist:0db35816362d20c7afd805aad02e0d54
Created August 3, 2018 02:35
Outlook GAL (Global Address List) Export
#initialize the Outlook application
[Microsoft.Office.Interop.Outlook.Application] $outlook = New-Object -ComObject Outlook.Application
#store all values from the default GAL to $entries
$entries = $outlook.Session.GetGlobalAddressList().AddressEntries
#declare array outside of the loop
$object = @()
#loop through all entries retrieved
@jerodg
jerodg / windows_and_office_kms_setup.adoc
Last active May 1, 2024 23:30
Activate Windows and Office Using KMS Server

Microsoft Windows and Office KMS Setup

@wareya
wareya / spi_recorder.ino
Last active May 1, 2024 23:29
long SPI message recorder - rasberry pi pico (rp2040), arduino IDE .ino file (C++)
// wiring example for ripping a PMW3360 SROM: https://i.imgur.com/EspAlvz.jpeg
// set the board to 240mhz or higher for best results (WARNING: higher than 240mhz only works with USB if you overvolt the MCU)
// this implements reading SPI mode 3. if you want a different mode, you need to edit these two lines:
// uint32_t clockval = (1 << pin_clock);
// if (newclock && !clockval && buff_i < buffsize)
#include <pico/stdlib.h>
#define buffsize 50000
@RubenKelevra
RubenKelevra / fast_firefox.md
Last active May 1, 2024 23:27
Make Firefox fast again
@officialmofabs
officialmofabs / auto_git_file.md
Created May 1, 2024 23:18 — forked from darencard/auto_git_file.md
Automatic file git commit/push upon change

Please see the most up-to-date version of this protocol on my blog at https://darencard.net/blog/.

Automatically push an updated file whenever it is changed

Linux

  1. Make sure inotify-tools is installed (https://github.com/rvoicilas/inotify-tools)
  2. Configure git as usual
  3. Clone the git repository of interest from github and, if necessary, add file you want to monitor
  4. Allow username/password to be cached so you aren't asked everytime
@antlionguard
antlionguard / twitter-remove-retweets.js
Last active May 1, 2024 23:22
With this script, you can remove all retweets you are retweeted on Twitter.
const timer = ms => new Promise(res => setTimeout(res, ms));
// Unretweet normally
const unretweetTweet = async (tweet) => {
await tweet.querySelector('div[data-testid="unretweet"]').click();
await timer(250);
await document.querySelector('div[data-testid="unretweetConfirm"]').click();
console.log('****// Unretweeted Successfully //****')
}
@enomoto
enomoto / LocaleExtension.swift
Last active May 1, 2024 23:22
Change locale in XCTestCase
private extension MyTests {
private func setLocaleAsJP() {
let original = class_getClassMethod(NSLocale.self, #selector(getter: NSLocale.current))!
let swizzled = class_getClassMethod(NSLocale.self, #selector(NSLocale.myCurrentLocale))!
method_exchangeImplementations(original, swizzled)
}
}
// https://stackoverflow.com/questions/31065859/how-can-i-change-the-locale-on-the-xcode-playground
fileprivate extension NSLocale {
@FusRoDah061
FusRoDah061 / dump-uwp-apps.md
Created April 3, 2021 01:24
Dump UWP apps files

Overview

Most apps and games downloaded from Microsoft Store on Windows 10 are placed on a special folder (WindowsApps), which the user probably won't have access.

That said, in case you want to use mods in a game, you'll likely need access to the it's files. Even though Microsoft introduced the option to enable mods, not all developers have adopted this yet (if some ever will). This document presents an alternative to get access to the files you may need.

This is basically a copy-paste of u/WiredRawdy's reddit post.

Requirements

@ahbanavi
ahbanavi / encryption.php
Last active May 1, 2024 23:18
Encrypt / Decrypt JSON data between Python and PHP using AES 256 GCM
<?php
const PASSPHRASE = ''; // use 'openssl rand -hex 32' to generate key, same with python
function encrypt(array $data): string
{
$data_json_64 = base64_encode(json_encode($data));
$secret_key = hex2bin(PASSPHRASE);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-gcm'));
$tag = '';
$encrypted_64 = openssl_encrypt($data_json_64, 'aes-256-gcm', $secret_key, 0, $iv, $tag);