Skip to content

Instantly share code, notes, and snippets.

View jsarenik's full-sized avatar

Ján Sáreník jsarenik

View GitHub Profile
@lox
lox / mirror_test.sh
Last active November 7, 2023 17:33
A bash script to select the fastest ubuntu apt geo-mirror
#!/bin/bash -e
# mirror_test.sh
# benchmarks closest ubuntu mirrors and outputs them in speed order
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/lox/9152137/raw/mirror_test.sh)"
RELEASE=$(lsb_release -c -s 2>/dev/null || echo 14.04)
MIRRORS=$(curl -s http://mirrors.ubuntu.com/mirrors.txt)
TESTFILE="dists/$RELEASE/main/binary-amd64/Packages.bz2"
TIMEOUT=1
@eatnumber1
eatnumber1 / renameat2.c
Last active November 3, 2023 17:24
Command-line tool to call renameat2(2)
/*
* Copyright (c) 2023 Russell Harmon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@bradoaks
bradoaks / hfsc-shape.sh
Created April 25, 2011 14:51 — forked from eqhmcow/hfsc-shape.sh
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
@JakubVanek
JakubVanek / Framebuffer to PNG
Last active May 5, 2023 21:10
Convert raw BGRA framebuffer to RGB png file
This program can be used to convert raw BGRA 8888 framebuffer to standard PNG file.
@godber
godber / ncp
Created January 10, 2015 13:38
ncp - Netcat and Pigz based network file copy (faster than scp, but unencrypted)
#! /usr/bin/bash
# ncp - Netcat and Pigz based network file copy (faster than scp, but unencrypted)
# From this blog post
# http://intermediatesql.com/linux/scrap-the-scp-how-to-copy-data-fast-using-pigz-and-nc/
FILE_FULL=$1
REMOTE_HOST=$2
FILE_DIR=$(dirname $FILE_FULL)
@gavinandresen
gavinandresen / BlockPropagation.md
Last active March 14, 2023 09:45
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@CoinWhisperer
CoinWhisperer / burn-btc
Last active November 2, 2021 17:38
A simple python program to create bitcoin burn addresses.
#! /usr/bin/env python
"""
burn-btc: create a bitcoin burn address
By James C. Stroud
This program requries base58 (https://pypi.python.org/pypi/base58/0.2.1).
Call the program with a template burn address as the only argument::
@penk
penk / main.cpp
Last active June 29, 2021 23:25
minimal QtWebEngine example
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtWebEngine/qtwebengineglobal.h>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
QQmlApplicationEngine appEngine;
appEngine.load(QUrl("main.qml"));
@pezz
pezz / crypto-pi-root.md
Last active December 17, 2020 15:40
Archlinux ARM encrypted root

Intro

Just some FYI, to get started:

  • I'm using a 16 GB Sandisk SD card.
  • I have a model B Pi, 512 MB RAM (not really relevant, thought I'd mention it).
  • Monitor and keyboard connected to the Pi itself, for now.
  • Network working, internet access.