Skip to content

Instantly share code, notes, and snippets.

View GiovanniGrieco's full-sized avatar
💭
mumble mumble

Giovanni Grieco GiovanniGrieco

💭
mumble mumble
View GitHub Profile
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active September 28, 2024 22:54
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

@PeteGoo
PeteGoo / Send-UdpDatagram.ps1
Last active November 6, 2024 15:22
Sending UDP datagrams in powershell
function Send-UdpDatagram
{
Param ([string] $EndPoint,
[int] $Port,
[string] $Message)
$IP = [System.Net.Dns]::GetHostAddresses($EndPoint)
$Address = [System.Net.IPAddress]::Parse($IP)
$EndPoints = New-Object System.Net.IPEndPoint($Address, $Port)
$Socket = New-Object System.Net.Sockets.UDPClient
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active July 7, 2024 19:47
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@robert-claypool
robert-claypool / debian-fullscreen-in-hyperv.md
Created July 13, 2016 18:05
How To Make Debian Linux Fullscreen in Hyper-V
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active November 14, 2024 10:34
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@SteveMarshall
SteveMarshall / send-magic-packet.sh
Created April 7, 2017 12:28
Wake-On-Lan Magic Packet using netcat in bash
#!/usr/bin/env bash
mac_address=$1
# Strip colons from the MAC address
mac_address=$(echo $mac_address | sed 's/://g')
broadcast=$2
port=4343
# Magic packets consist of 12*`f` followed by 16 repetitions of the MAC address
@comzeradd
comzeradd / fedora-arm-headless.txt
Created May 9, 2017 18:40
fedora-arm headless
USER= # your user account
rm /run/media/$USER/__/etc/systemd/system/graphical.target.wants/initial-setup-graphical.service
rm /run/media/$USER/__/etc/systemd/system/multi-user.target.wants/initial-setup-text.service
mkdir /run/media/$USER/__/root/.ssh/
cat /home/$USER/.ssh/id_rsa.pub >> /run/media/$USER/__/root/.ssh/authorized_keys
chmod -R u=rwX,o=,g= /run/media/$USER/__/root/.ssh/
@matsest
matsest / pandoc-setup.md
Last active May 7, 2021 10:08
pandoc-latex-setup

Pandoc Setup

Description

A simple setup for Sublime to jot down notes in Markdown and compile a nice PDF with LaTeX through Pandoc conversion.

Why? Markdown is quick and easy to write, LaTeX is more of a hassle. But LaTeX produces nice PDFs. Using Pandoc, you can utilize the best features of both worlds by writing in markdown and compiling PDFs with LaTeX, with a simple one-click in your editor. This works fairly well for simple documents and pandoc supports most of Markdown syntax, in addition to supporting a range of variables set in a YAML meta block. Did I mention that it also supports writing LaTeX-style math and other LaTeX-commands in your Document? (Like this: $e^{i\pi}+1 = 0$ )

The output PDF is a A4 paper with 12pt font and 1 inch margins. It uses fancyhead to style the header and footer with date, pagenumbering and title/author. (This can be changed in your Pandoc-settings)

@jjmartres
jjmartres / how-to-reduce-size-of-docker-data-volume-in-docker-desktop-for-windows-v2.md
Last active February 20, 2024 04:33
How to reduce size of docker data volume in Docker Desktop for Windows v2

How to reduce size of docker data volume in Docker Desktop for Windows v2

Docker Desktop for Windows v2, which uses WSL2, stores all image and container files in a separate virtual volume (vhdx). This virtual hard disk file can automatically grow when it needs more space (to a certain limit). Unfortunately, if you reclaim some space, i.e. by removing unused images, vhdx doesn't shrink automatically.

Optimize

wsl --shutdown
Optimize-VHD -Path "$($env:LOCALAPPDATA)\Docker\wsl\data\ext4.vhdx" -Mode Full
@SwitHak
SwitHak / 20211210-TLP-WHITE_LOG4J.md
Last active November 8, 2024 17:29
BlueTeam CheatSheet * Log4Shell* | Last updated: 2021-12-20 2238 UTC

Security Advisories / Bulletins / vendors Responses linked to Log4Shell (CVE-2021-44228)

Errors, typos, something to say ?

  • If you want to add a link, comment or send it to me
  • Feel free to report any mistake directly below in the comment or in DM on Twitter @SwitHak

Other great resources

  • Royce Williams list sorted by vendors responses Royce List
  • Very detailed list NCSC-NL
  • The list maintained by U.S. Cybersecurity and Infrastructure Security Agency: CISA List