Skip to content

Instantly share code, notes, and snippets.

View gabrielmocanu's full-sized avatar
⛷️
Focusing

Gabriel Mocanu gabrielmocanu

⛷️
Focusing
View GitHub Profile
@gabrielmocanu
gabrielmocanu / remove-old-gh-workflow.sh
Created November 15, 2023 12:19
Delete old GitHub Actions workflow runs
#!/bin/bash
# This is a script to remove old GitHub Actions workflow runs for a given workflow path
# It is helpful for cleaning up old workflow runs after you renamed the workflow
org=<ORGANIZATION-NAME>
repo=<REPOSITORY-NAME>
workflow_path=".github/workflows/<OLD_WORKFLOW_NAME>"
# Get workflow IDs with path = $path_workflow
workflow_ids=($(gh api repos/$org/$repo/actions/workflows --paginate | jq '.workflows[] | select(.path == '\"$workflow_path\"') | .id'))
@gabrielmocanu
gabrielmocanu / super-linter.sh
Created September 2, 2023 12:53
Run `super-linter` locally
#!/bin/bash
# PATH_TO_CODEBASE: The path to the codebase you want to lint. Don't use relative paths.
# PATH_TO_LINT_RULES: The path to the lint rules you want to use. Don't use relative paths.
# OPTIONS:
# -i enters the super-linter container
# Example: ./super-linter.sh /path/to/codebase/to/be/check /path/to/.github/workflows from the root of the repo
PATH_TO_CODEBASE=$(realpath "$1")
@gabrielmocanu
gabrielmocanu / Makefile
Created July 3, 2023 15:21
Generic Makefile used for development containers
# Directories
WORKDIR ?= $(CURDIR)
TESTDIR ?= $(WORKDIR)/tests
DISTDIR ?= $(WORKDIR)/dist
PROJECT_NAME ?= project-name
# Arguments
REGISTRY ?= REGISTRY_NAME
ORG ?= ORG_NAME
REPO ?= REPO_NAME
@gabrielmocanu
gabrielmocanu / pwn-template.py
Last active February 1, 2023 15:45
This is a starter script for every binary exploit.
from pwn import *
from ctypes import *
import time
import sys
def generate_random_number():
LIBC_CODE.srand(int(time.time()))
rand_number = LIBC_CODE.rand()
rand_number |= LIBC_CODE.rand() << 32
return rand_number
@gabrielmocanu
gabrielmocanu / bash-args
Last active November 16, 2022 11:23
It is a template for a bash script for parsing arguments. It also accepts simple arguments (getops), but also complex arguments.
#!/bin/bash
script_name=$0
# Function for helping with usage
function usage
{
echo "Usage: $script_name -f arg_1 -s arg_2 -t arg_3"
echo ""
echo " -f | --first_arg : First argument(Mandatory)"
@gabrielmocanu
gabrielmocanu / config.yml
Created August 23, 2022 21:49
WTFUtil configuration template
wtf:
colors:
border:
focusable: darkslateblue
focused: orange
normal: gray
grid:
columns: [32, 32, 32, 32, 90]
rows: [10, 10, 10, 4, 4, 90]
refreshInterval: 1
@gabrielmocanu
gabrielmocanu / generate-shellcode
Created March 14, 2022 20:12
Makefile to generate shellcode from an assembly file using nasm.
.PHONY: all clean
all: shellcode.bin
shellcode.bin: shellcode.asm
nasm -o $@ $^
print: shellcode.bin
@hexdump -v -e '"\\" 1/1 "x%02x"' $^ ; echo