Skip to content

Instantly share code, notes, and snippets.

View LeShadow's full-sized avatar
💭
¯\_(ツ)_/¯

Sebastiaan Provost LeShadow

💭
¯\_(ツ)_/¯
View GitHub Profile
@mttaggart
mttaggart / sysmon-linux-pipeline.json
Last active December 30, 2023 11:18
Sysmon for Linux Pipeline for Elastic Agent
{ "processors": [
{
"dissect": {
"field": "message",
"pattern": "<Event><System><Provider Name=\"Linux-Sysmon\" Guid=\"{ff032593-a8d3-4f13-b0d6-01fc615a0f97}\"/><EventID>%{event.id}</EventID>",
"description": "Extract Sysmon System Data"
}
},
{
"dissect": {
#!/usr/bin/env python3
# quick bodge based on: https://rushter.com/blog/public-ssh-keys/
import socket
import sys
import paramiko.auth_handler
import argparse
def valid(self, msg):
@jdarpinian
jdarpinian / executable.c
Last active May 30, 2024 19:42
Add one line to your C/C++ source to make it executable.
///$(which true);FLAGS="-g -Wall -Wextra --std=c17 -O1 -fsanitize=address,undefined";THIS_FILE="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")";OUT_FILE="/tmp/build-cache/$THIS_FILE";mkdir -p "$(dirname "$OUT_FILE")";test "$THIS_FILE" -ot "$OUT_FILE" || $(which clang || which gcc) $FLAGS "$THIS_FILE" -o "$OUT_FILE" || exit $?;exec bash -c "exec -a \"$0\" \"$OUT_FILE\" $([ $# -eq 0 ] || printf ' "%s"' "$@")"
#include <stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
@sudomain
sudomain / LHTL notes
Last active December 13, 2023 16:48
Notes from Learning How to Learn MOOC
*Original intruction material by Dr. Barbara Oakley and Dr. Terrence Sejnowski as part of their MOOC "Learning How to Learn" available via Coursera (August 2017)
*Notes by Amir Saleh (not me) who shared his notes accessible via the discussion forums (https://docs.google.com/document/d/1GVYaVOVT2G9MS6ku6tLjhvoMazh7rWdqUu0Kts5C3Fc/edit)
*Reproduced per the paraphrasing rule outlined in the course FAQ:
*"We're often asked whether it's okay to use illustrations or quoted material from the course or book in your final project. It's perfectly possible to use illustrations from the course or book, but please cite where you got them, with the copyright information. If you quote anything from the video clips or the book A Mind for Numbers, you'll put it in quotation marks and cite where you got it. If you paraphrase information from the video clips or A Mind for Numbers--that is, you put things in your own words--then there's no need to put in a reference, although it would be nice to put some sort of general referenc
@ageis
ageis / systemd_service_hardening.md
Last active November 15, 2024 09:28
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@adamwathan
adamwathan / belongs-to-many.sublime-snippet
Last active August 3, 2024 16:44
Eloquent Relationship snippets for Sublime Text
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@joepie91
joepie91 / getting-started.md
Last active July 7, 2024 02:41
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

@bnagy
bnagy / gpgmutt.md
Last active August 10, 2024 22:44
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@andelf
andelf / sighup.go
Created June 29, 2013 05:25
golang process SIGHUP, HUP signal to reload configuration
// program
package main
import "os/signal"
import "os"
import "fmt"
import "syscall"
import "time"
@dbrown29
dbrown29 / dpkt_netbios_mdns.py
Created October 2, 2012 06:50 — forked from m-mizutani/dpkt_netbios_mdns.py
packet dump with pcapy & dpkt in Python
#!/usr/bin/env python
# coding: utf-8
#----------------------------------------------------
# packet capture & decoding
import pcapy
import dpkt
class network_monitor:
def __init__ (self):