Skip to content

Instantly share code, notes, and snippets.

@kerard
kerard / test-dc-ports.ps1
Created March 28, 2022 17:29
domain controller ports test
$ports = "135","389","636","3268","53","88","445","3269"
$dcs = Get-ADDomainController -Filter *
ForEach($dc in $dcs)
{
Foreach ($p in $ports)
{
$_test = Test-NetConnection $dc.Hostname -Port $p -WarningAction SilentlyContinue
If ($_test.tcpTestSucceeded -eq $true)
@drmalex07
drmalex07 / convertUuidToBigInteger.java
Last active May 1, 2024 21:29
Convert a UUID to an unsigned BigInteger #java #UUID #BigInteger
public static final BigInteger B = BigInteger.ONE.shiftLeft(64); // 2^64
public static final BigInteger L = BigInteger.valueOf(Long.MAX_VALUE);
public static BigInteger convertToBigInteger(UUID id)
{
BigInteger lo = BigInteger.valueOf(id.getLeastSignificantBits());
BigInteger hi = BigInteger.valueOf(id.getMostSignificantBits());
// If any of lo/hi parts is negative interpret as unsigned
@jasoncodes
jasoncodes / README
Last active May 1, 2024 21:29
Remote Chrome browser for Capybara
On the shared machine:
Download http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.33.0.jar&can=2&q=
$ brew install chromedriver
$ java -jar selenium-server-standalone-2.33.0.jar
On the local machine:
Set `CHROME_HOSTNAME` in your `.env`, `.rbenv_vars`, or per run.
@james-roden
james-roden / Rotation_Matrix_Function.py
Created February 22, 2018 09:22
Python function to rotate a (x, y) coordinate by a specified angle
# Rotation matrix function
def rotate_matrix (x, y, angle, x_shift=0, y_shift=0, units="DEGREES"):
"""
Rotates a point in the xy-plane counterclockwise through an angle about the origin
https://en.wikipedia.org/wiki/Rotation_matrix
:param x: x coordinate
:param y: y coordinate
:param x_shift: x-axis shift from origin (0, 0)
:param y_shift: y-axis shift from origin (0, 0)
:param angle: The rotation angle in degrees
@LyleScott
LyleScott / rotate_2d_point.py
Last active May 1, 2024 21:26
Rotate X,Y (2D) coordinates around a point or origin in Python
"""
Lyle Scott, III // lyle@ls3.io
Multiple ways to rotate a 2D point around the origin / a point.
Timer benchmark results @ https://gist.github.com/LyleScott/d17e9d314fbe6fc29767d8c5c029c362
"""
from __future__ import print_function
import math
@andrelop
andrelop / gist:941be7f182c11a4a3204f6a9031258a2
Last active May 1, 2024 21:26
Example backup script for Mastodon, WriteFreely and Miniflux
#!/bin/bash
TODAY=$(date +%Y%m%d)
YESTERDAY=$(date --date '1 day ago' +%Y%m%d)
# Backup Mastodon database
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'rm -rf /var/lib/postgresql/data/'${YESTERDAY}' || true'
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'mkdir /var/lib/postgresql/data/'${TODAY}' || true'
docker exec -it $(docker ps | grep mastodon_postgresql | awk '{print $1}') bash -c 'pg_dumpall -c -U mastodon > /var/lib/postgresql/data/'${TODAY}'/mastodon-dump.sql'
@lcsouzamenezes
lcsouzamenezes / MakerUNOSIM7600.ino
Created May 1, 2024 21:23 — forked from IdrisCytron/MakerUNOSIM7600.ino
Send and receive SMS using SIM7600 GSM module and Arduino.
/*
Project: Interfacing SIM7600 GSM Module with Maker UNO
Item used:
- Maker UNO https://www.cytron.io/p-maker-uno
- SIM7600 https://www.cytron.io/p-4g-3g-2g-gsm-gprs-gnss-hat-for-raspberry-pi
*/
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
@OrionReed
OrionReed / dom3d.js
Last active May 1, 2024 21:23
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@jalogut
jalogut / docker_space_cheat_sheet.md
Last active May 1, 2024 21:21
Cheat sheet to check disk usage on docker. Identify what takes most of your space

Total disk size configuration (Mac)

ls -klsh ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

Total disk usage (Mac)

du -h ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw
@zhuowei
zhuowei / reachable_services.txt
Created February 21, 2023 06:26
Reachable Mach services from the app sandbox on iOS 16.1
PurpleSystemAppPort
PurpleSystemEventPort
UIASTNotificationCenter
com.apple.ABDatabaseDoctor
com.apple.AppSSO.service-xpc
com.apple.AuthenticationServicesCore.AuthenticationServicesAgent
com.apple.CARenderServer
com.apple.ClipServices.clipserviced
com.apple.CoreAuthentication.daemon
com.apple.DeviceAccess.xpc