Skip to content

Instantly share code, notes, and snippets.

View akoskovacs's full-sized avatar

Ákos Kovács akoskovacs

View GitHub Profile
@akoskovacs
akoskovacs / blinker.v
Created September 3, 2020 22:19
Spartan Edge Blinker project
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2019/08/05 11:02:11
// Design Name:
// Module Name: blinker
// Project Name:
// Target Devices:
@akoskovacs
akoskovacs / server.sh
Created September 16, 2020 18:54
Server start/stop/ssh script
#!/bin/bash
# Copy this script to your /usr/local/bin/ /usr/bin, or put its path into PATH
# Customize these:
SERVER_MAC="44:8a:xx:xx:xx:xx"
CLIENT_IFACE="wlp2s0"
SSH_PARAM="user@address"
# ----
myhelp() {
@akoskovacs
akoskovacs / rplace.rb
Last active April 17, 2022 15:22
Ugly/slow/unoptimized/naive PoC r/place exporter from DB to PNG
#!/usr/bin/ruby
require 'io/console'
require 'pg'
require 'chunky_png'
WIDTH = 2000
HEIGHT = 2000
ROWS = 10000
OUTFILE = 'rplace.png'
@akoskovacs
akoskovacs / api.js
Last active June 14, 2023 22:09
k6 API testing Lucky Framwork template
import http from 'k6/http';
import { check, group } from 'k6';
export let options = {
stages: [
{ duration: '0.5m', target: 3 }, // simulate ramp-up of traffic from 1 to 3 virtual users over 0.5 minutes.
{ duration: '0.5m', target: 4}, // stay at 4 virtual users for 0.5 minutes
{ duration: '0.5m', target: 0 }, // ramp-down to 0 users
],
};
@akoskovacs
akoskovacs / prune.sh
Created December 26, 2023 09:09
Prune all unused docker containers and images
#!/bin/bash
# Dump current disk usage
df -h
# Remove unused containers
yes | docker container prune
# Remove unused images
yes | docker image prune -a
# Dump saved disk space
df -h
@akoskovacs
akoskovacs / libmyrand.c
Created February 3, 2024 17:52
Monkey patching in C (Linux/Unix)
/*
* Let's redefine rand() by simply compiling creating an position-independent object code:
* $ gcc -c -fPIC libmyrand.c -o libmyrand.o
*
* Then create a shared library object from it:
* $ gcc libmyrand.o -shared -o libmyrand.so
*
* As a last step, load this dynamic library, so the dynamic linker will link this rand(),
* instead of the one inside the standard library:
* $ export LD_PRELOAD=./libmyrand.so