Skip to content

Instantly share code, notes, and snippets.

@martinsohn
martinsohn / ConvertFrom-BHJSON.ps1
Last active May 3, 2024 11:46
ConvertFrom-BHJSON
# See examples here: https://twitter.com/martinsohndk/status/1783470845119152340
# Add the below to your PowerShell profile
# 1. In PowerShell, run: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser -Force
# 2. In PowerShell, run: if(!(Test-Path $PROFILE)){New-Item $PROFILE -ItemType File -Force}; notepad.exe $PROFILE
# 3. Add the function to your PowerShell profile
# 4. (Optional) Change the default behaviour from Clipboard to some other in 'DefaultParameterSetName'
# 5. Start a new PowerShell instance
# 6. Export JSON from BloodHound
# 7. Convert the JSON with 'ConvertFrom-BHJSON' or the alias 'cfb'
@Norserium
Norserium / agGrid-ru.js
Created March 27, 2019 10:48
Russian localization for agGrid / Русская локализация для agGrid
{
// for filter panel
page: 'Страница',
more: 'ещё',
to: 'к',
of: 'из',
next: 'Следующая',
last: 'Последняя',
first: 'Первая',
previous: 'Предыдущая',
@klauspost
klauspost / dictionary-sorted.txt
Last active May 3, 2024 11:46
Brotli dictionary - printed escaped
" </div>"
" })();\r\n"
" && "
" &amp; "
" &nbsp;"
" ''The "
" (&quot;"
" (199"
" (200"
" (e.g."
@ZijiaLewisLu
ZijiaLewisLu / Tricks to Speed Up Data Loading with PyTorch.md
Last active May 3, 2024 11:44
Tricks to Speed Up Data Loading with PyTorch

In most of deep learning projects, the training scripts always start with lines to load in data, which can easily take a handful minutes. Only after data ready can start testing my buggy code. It is so frustratingly often that I wait for ten minutes just to find I made a stupid typo, then I have to restart and wait for another ten minutes hoping no other typos are made.

In order to make my life easy, I devote lots of effort to reduce the overhead of I/O loading. Here I list some useful tricks I found and hope they also save you some time.

  1. use Numpy Memmap to load array and say goodbye to HDF5.

    I used to relay on HDF5 to read/write data, especially when loading only sub-part of all data. Yet that was before I realized how fast and charming Numpy Memmapfile is. In short, Memmapfile does not load in the whole array at open, and only later "lazily" load in the parts that are required for real operations.

Sometimes I may want to copy the full array to memory at once, as it makes later operations

@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active May 3, 2024 11:43
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@joyrexus
joyrexus / README.md
Last active May 3, 2024 11:41
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

@prasathmani
prasathmani / upload-to-google-drive.py
Last active May 3, 2024 11:40
upload files to google drive using python
import requests, json
# Get refresh token from google drive api
# Generating a refresh token for DRIVE API calls using the OAuth playground
# https://www.youtube.com/watch?v=hfWe1gPCnzc
def getToken():
oauth = 'https://www.googleapis.com/oauth2/v4/token' # Google API oauth url
headers = {'content-type': 'application/x-www-form-urlencoded'}
data = {
'grant_type': 'refresh_token',
@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
@c22dev
c22dev / DEPSteps.md
Last active May 3, 2024 11:36
Remove MDM & DEP from an Apple Sillicon Mac (Sonoma)

How to make an MDM Mac shine like it's brand new ?

Works, as of 14/04/2024, on macOS 14.4.1 and lower (prob higher but idk)

This was made for Apple Sillicon Macs.

Restore Process

You need another Mac for this.

If you don't have one and have recovery locked, it's not possible.

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators