Skip to content

Instantly share code, notes, and snippets.

View DonBattery's full-sized avatar

DonBattery DonBattery

View GitHub Profile
@DonBattery
DonBattery / bin-pic
Created November 10, 2023 21:56
Picture file to bynary
#!/usr/bin/env python3
import argh
from PIL import Image
import argh
def convert(source_filename: str, destination_filename: str = "output.bin"):
@DonBattery
DonBattery / README.md
Last active December 19, 2021 04:46
MSSQL cheat sheet

List Users

select name as username,
       create_date,
       modify_date,
       type_desc as type,
       authentication_type_desc as authentication_type
from sys.database_principals
where type not in ('A', 'G', 'R', 'X')
@DonBattery
DonBattery / .gitconfig
Last active October 26, 2021 00:38
gitmm
[alias]
# git jm "commit message"
# will add the Jira ticket ID (e.g.: PROJ-123) to your commit message
jm = "!f() { [[ $(git branch --show-current) =~ [A-Z]{2,}-[0-9]+ ]]; git commit -m \"${BASH_REMATCH[0]} ${1}\"; }; f"
@DonBattery
DonBattery / email_info.py
Last active June 19, 2021 20:51
Extract info and attachments from a raw .eml Email file
# Based on https://stackoverflow.com/a/31392574/14711510
from pathlib import Path
import email
import email.utils as email_utils
import json
class EmailInfo:
def __init__(self, email_file: str) -> None:
email_file_path = Path(email_file)
#!/usr/bin/env bash
RADIO_PATH="${HOME}/pyradio"
PLAYLIST=${RADIO_PATH}/playlist
mkdir -p ${RADIO_PATH}
curl -s https://gist.githubusercontent.com/DonBattery/78e21751ee5540984d6baca4a36eef2b/raw/playlist > ${PLAYLIST}
while true
http://stream.klubradio.hu:8080/bpstream
https://stream.klubradio.hu:8443/bpstream
@DonBattery
DonBattery / index.html
Created January 30, 2020 11:51
minimal js game engine
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Tanx</title>
</head>
<body>
@DonBattery
DonBattery / Dockerfile
Last active December 19, 2019 20:13
Docker + docker-compose + authenticated gcloud sdk for GCP Container Optimized OS
# based on: https://hub.docker.com/r/dduportal/docker-compose/dockerfile
# Usage
# set DOCKER_HOST to the remote machine
# copy your gcp_credfile.json to pwd
# $ docker build -t my-compose .
# $ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock my-compose up -d --build --force-recreate
@DonBattery
DonBattery / gimme.sh
Last active July 8, 2020 14:52
Fast POC bootstrap with BASH
#!/usr/bin/env bash
set -eou pipefail
GIMME_DIR="${HOME}/dev/gimme"
LEGAL_PROJ_TYPES=("go" "bash" "js" "py")
function usage {
echo "
@DonBattery
DonBattery / Dockerfile
Created December 15, 2019 08:25
Multistage Golang Dockerfile
FROM golang AS builder
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o my-app .
FROM alpine:latest