Skip to content

Instantly share code, notes, and snippets.

@andreswebs
andreswebs / aws-ec2-ubuntu-desktop.md
Last active April 19, 2024 03:22
Set up a desktop environment accessible via RDP on an AWS EC2 instance running Ubuntu

add a non-root user with sudo permissions

(The username in this example is desktop.)

sudo addgroup --gid 2000 desktop
sudo adduser \
    --gid 2000 \
    --uid 2000 \
    --gecos "" \
@khalidx
khalidx / node-typescript-esm.md
Last active November 14, 2024 08:26
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@michal-kazmierczak
michal-kazmierczak / prometheus_metrics_management.json
Last active October 13, 2024 11:02
Prometheus Metrics Management
{
"__inputs": [
{
"name": "default",
"label": "default",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@invictus-ir
invictus-ir / CloudTrail.csv
Last active October 23, 2024 18:21
An overview of CloudTrail events that are interesting from an Incident Response perspective
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 10 columns, instead of 9 in line 7.
"Initial Access","Execution","Persistence","Privilege Escalation","Defense Evasion","Credential Access","Discovery","Lateral Movement","Exfiltration","Impact"
ConsoleLogin,StartInstance,CreateAccessKey,CreateGroup,StopLogging,GetSecretValue,ListUsers,AssumeRole,CreateSnapShot,PutBucketVersioning
PasswordRecoveryRequested,StartInstances,CreateUser,CreateRole,DeleteTrail,GetPasswordData,ListRoles,SwitchRole,ModifySnapshotAttributes ,RunInstances
,Invoke,CreateNetworkAclEntry,UpdateAccessKey,UpdateTrail,RequestCertificate,ListIdentities,,ModifyImageAttribute,DeleteAccountPublicAccessBlock
,SendCommand,CreateRoute,PutGroupPolicy,PutEventSelectors,UpdateAssumeRolePolicy,ListAccessKeys,,SharedSnapshotCopyInitiated,
,,CreateLoginProfile,PutRolePolicy,DeleteFlowLogs,,ListServiceQuotas,,SharedSnapshotVolumeCreated,
,,AuthorizeSecurityGroupEgress,PutUserPolicy,DeleteDetector,,ListInstanceProfiles,,ModifyDBSnapshotAttribute,
,,AuthorizeSecurityGroupIngress,AddRoleToInstanceProfile,DeleteMembers,,ListBuckets,,PutBucketP
@lithdew
lithdew / main.ts
Last active May 11, 2023 06:31
deno (udp holepunching): basic stun client for fetching public-facing ip:port
// deno run -A --unstable main.ts
export const classToValue = {
request: 0x0000,
indication: 0x0010,
success: 0x0100,
failure: 0x0110,
};
export const methodToValue = {
@kfox
kfox / README.md
Last active December 4, 2023 11:08
TCP echo server for Node.js

TCP echo server for Node.js

Usage

  1. Make sure you have a modern-ish version of Node.js installed.
  2. Type npx https://gist.github.com/kfox/1280c2f0ee8324067dba15300e0f2fd3
  3. Connect to it from a client, e.g. netcat or similar: nc localhost 9000
@smontanaro
smontanaro / dusort.sh
Created November 7, 2022 11:01
I got this du postprocessing script from "the net" in the dark ages (probably from Usenet in the 80s or 90s). I have no idea who the original author was. I've never modified it **at all**. It has always just worked.
#!/bin/sh
#
# sort a "du" listing by directory size
# usage: du | dusort
FILES=
TFORM=0
while test $# -ge 1; do
case $1 in
-t) TFORM=1; ;;
@mislav
mislav / config.json
Last active August 2, 2024 14:35
Experiment in using GitHub CLI to authenticate fetching docker images from GitHub Package Registry
// ~/docker/config.json
{
"credsStore": "desktop",
"credHelpers": {
"docker.pkg.github.com": "gh",
"ghcr.io": "gh"
}
}
@yokawasa
yokawasa / ghcr.md
Last active October 14, 2024 13:38
ghcr (GitHub Container Registry)

ghcr (GitHub Container Registry) quickstart

CLI

To push container images to ghcr, you need peronal access token (PAT) - see how to create PAT

  1. Get PAT (personal access token)

Personal Settings > Developer settings > Personal access tokens

@refo
refo / Disable Microsoft AutoUpdate on MacOS.md
Last active November 3, 2024 07:37
Disable Microsoft AutoUpdate on MacOS (Office 365 updater)

Following commands disables Microsoft AutoUpdate launch agent from launching at boot and periodicaly checking for updates.

sudo defaults write /Library/LaunchAgents/com.microsoft.update.agent.plist Disabled -bool YES
sudo defaults write /Library/LaunchAgents/com.microsoft.update.agent.plist RunAtLoad -bool NO
sudo chflags schg /Library/LaunchAgents/com.microsoft.update.agent.plist

source: https://forums.macrumors.com/threads/how-to-get-rid-of-microsoft-autoupdate.2231809/?post=28384662#post-28384662