Skip to content

Instantly share code, notes, and snippets.

View System-Glitch's full-sized avatar

SystemGlitch System-Glitch

View GitHub Profile
@System-Glitch
System-Glitch / png2webp
Created February 4, 2021 11:05
Converts many PNG images to WEBP using cwebp
#!/bin/bash
# Converts PNG images to WEBP
# If no argument is given, all PNG images in the
# working directory are converted.
# Otherwise only the files given as arguments will be
# converted.
files="$@"
if [ $# -eq 0 ]; then
@System-Glitch
System-Glitch / go-worker.go
Last active January 5, 2022 15:11
A resilient Go worker
package main
// This is an example of a resilient worker program written in Go.
//
// This program will run a worker, wait 5 seconds, and run it again.
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work
// is finished before exiting.
//
// Unexpected panics are also handled: program won't crash if the worker panics.
// However, panics in goroutines started by the worker won't be handled and have
@System-Glitch
System-Glitch / Dockerfile
Last active July 23, 2021 07:01
Goyave development docker-compose
FROM golang:1.15-alpine
LABEL maintainer="Jérémy LAMBERT (SystemGlitch) <jeremy.la@outlook.fr>"
RUN apk update && apk upgrade && apk add --no-cache git openssh
RUN go get github.com/cespare/reflex
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
@System-Glitch
System-Glitch / heighway.py
Created December 22, 2019 16:12
Heighway dragon fractal recursive implementation in Python
import png #pip3 install pypng
import math
class Heighway:
def __init__(self, size = 1000):
self.size = size
def init_grid(self):
self.grid = []
@System-Glitch
System-Glitch / Dockerfile
Last active September 18, 2023 04:48
Docker-compose for Laravel + MariaDB development
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y \
git \
zip \
curl \
sudo \
unzip \
libicu-dev \
libbz2-dev \

Rust Pipe

A rust implementation of the pipe operator.

Example

# Using cargo run
cargo run -- --in curl https://systemglitch.me --out grep SystemGlitch
@System-Glitch
System-Glitch / Monopoly.sol
Created March 15, 2019 13:16
Malicious Monopoly smart contract
pragma solidity ^0.5.6;
contract Monopoly {
struct Player {
uint balance;
bool exists;
}
uint constant contribution = 1 ether;
@System-Glitch
System-Glitch / generate_blocks.sh
Last active April 25, 2024 11:38
Tutorial for bitcoin regtest
# Script to generate a new block every minute
# Put this script at the root of your unpacked folder
#!/bin/bash
echo "Generating a block every minute. Press [CTRL+C] to stop.."
address=`./bin/bitcoin-cli getnewaddress`
while :
do
@System-Glitch
System-Glitch / LinkedList.c
Last active March 15, 2023 18:44
A simple generic linked list implementation in C
#include <stdlib.h>
#include "LinkedList.h"
/**
* Creates an empty linkedlist_t. head is set to NULL and length to 0.
*/
linkedlist_t *linkedlist_init() {
linkedlist_t *list = malloc(sizeof(linkedlist_t));
if(list == NULL) return NULL;
list->length = 0;
//This code allows you to know if the player is critical hitting
//This has to be used in EntityDamageByEntityEvent
//"p" is the Player variable
boolean crit = ((CraftPlayer) p).getHandle().fallDistance > 0.0F && !((CraftPlayer) p).getHandle().onGround && !((CraftPlayer) p).getHandle().n_() && !((CraftPlayer) p).getHandle().isInWater() && !((CraftPlayer) p).getHandle().hasEffect(MobEffects.BLINDNESS) && !((CraftPlayer) p).getHandle().isPassenger();
crit = crit && !((CraftPlayer) p).getHandle().isSprinting();