Skip to content

Instantly share code, notes, and snippets.

@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@mdonkers
mdonkers / server.py
Last active April 24, 2024 06:50
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@michaelbutler
michaelbutler / Steam_Proton_Exe.md
Last active April 24, 2024 06:49
How to run another .exe in an existing proton wine prefix

Running games through Steam's Proton is great. But what if there is a secondary exe or configuration application bundled with the game? How can you launch it if Steam itself only launches the game?

Simply run this command in a terminal:

cd /path/to/steam/steamapps/compatdata/20920/pfx

STEAM_COMPAT_DATA_PATH="/path/to/steam/steamapps/compatdata/20920" WINEPREFIX=$PWD \
    "$HOME/.steam/root/steamapps/common/Proton 5.0/proton" run ./drive_c/path/to/custom_application.exe
@borgstrom
borgstrom / human_time_duration.py
Created May 9, 2018 04:00
Python: Convert seconds (duration) to human readable string
TIME_DURATION_UNITS = (
('week', 60*60*24*7),
('day', 60*60*24),
('hour', 60*60),
('min', 60),
('sec', 1)
)
def human_time_duration(seconds):
@mihaidusmanu
mihaidusmanu / rec_stats.py
Created October 24, 2020 14:48
COLMAP covisibility
def compute_reconstruction_statistics(reference_model_path):
# Images w. intrinsics and extrinsics.
with open(os.path.join(reference_model_path, 'cameras.txt'), 'r') as f:
raw_cameras = f.readlines()[3 :]
cameras = {}
for raw_line in raw_cameras:
split_line = raw_line.strip('\n').split(' ')
cameras[int(split_line[0])] = split_line[1 :]
@moiri
moiri / backend.ts
Last active April 24, 2024 06:48
Type Conversions from String to MongoDB ObjectId
import { ObjectId } from 'mongodb';
/* Use this to extend any interface with an `_id` property of type OID */
export type TWithOid<T extends {}> = T & {
_id: ObjectId;
};
/**
* Replaces a string property with the same property of type ObjectId.
@philmcmahon
philmcmahon / qubes-blogpost-ben-grande-feedback.txt
Created April 9, 2024 17:58
Feedback on Qubes/Salt blogpost from Ben Grande
- Always enforce preferences on the `qvm.prefs` module: many times I see
`label` only in `qvm.present`, which is only run on creation of the
qube, not when it already exists. The `qvm.prefs` module is checked
everytime even if the qube already exists. I think label should be
enforced not let for the user to modify and then later the state
ignore the label change, but of course I don't know your internal
policy about this matter and I might be wrong depending on it.
- Do not specify literal names as the `source` value of `qvm.clone`,
aahed
aalii
aapas
aargh
aarti
abaca
abaci
aback
abacs
abaft
import 'dart:async';
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
// #docregion platform_imports
// Import for Android features.
// import 'package:webview_flutter_android/webview_flutter_android.dart';
@zblurx
zblurx / lapsv2_decryptor.py
Last active April 24, 2024 06:42
Simple script to extract local admin password in cleartext with LAPSv2 using impacket
import argparse
import typing
import math
from uuid import UUID
from pyasn1.codec.der import decoder
from pyasn1_modules import rfc5652
from struct import unpack
from cryptography import utils
from cryptography.exceptions import AlreadyFinalized, InvalidKey
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction