Skip to content

Instantly share code, notes, and snippets.

@hopeseekr
hopeseekr / docker_dedicated_filesystem.md
Created February 3, 2018 04:01
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@jarun
jarun / disassemble.md
Last active April 26, 2024 14:18
Guide to disassemble

prerequisites

  • Compile the program in gcc with debug symbols enabled (-g)
  • Do NOT strip the binary
  • To generate assembly code using gcc use the -S option: gcc -S hello.c

utilities

objdump

@lifepillar
lifepillar / 24-bit-color.sh
Created November 20, 2017 11:48
Test 24 bit colors in terminals
#!/bin/bash
#
# This file echoes a bunch of 24-bit color codes
# to the terminal to demonstrate its functionality.
# The foreground escape sequence is ^[38;2;<r>;<g>;<b>m
# The background escape sequence is ^[48;2;<r>;<g>;<b>m
# <r> <g> <b> range from 0 to 255 inclusive.
# The escape sequence ^[0m returns output to default
setBackgroundColor()

How to update a borrowck test for MIR borrowck

When we fix a bug in MIR borrowck, we often want to update an existing test and show that it does the same thing for MIR and AST borrowck. This gist describes the steps to do it.

compile-fail tests

An example of a test that has been updated to test both MIR and AST borrowck is borrowck-match-already-borrowed.

@yangxuan8282
yangxuan8282 / compile-mpv-mmal-rpi.md
Last active June 3, 2020 14:23
compile mpv with hardware acceleration (mmal) on RPi, no windows borders

mpv

The latest working mpv version for this guides is 0.27.2, tested on 2018-03-13-raspbian-stretch.

sudo apt-get update && sudo apt-get upgrade -y && 
sudo apt-get install -y git devscripts equivs &&
sudo apt-get install -y libgles2-mesa-dev
@woctezuma
woctezuma / hidden_gems_using_players.md
Last active April 17, 2024 15:06
Hidden Gems, using players total (forever) as a popularity measure

This post contains a ranking of Steam games, based on a score intended to favor "hidden gems". A "hidden gem" is defined as a high-quality game (hence the "gem") which only got little attention (hence "hidden"). Therefore, the score of a game is defined as the product of a quality measure (its Wilson score) and a decreasing function of a popularity measure (its players total forever). The quality measure comes from SteamDB and the popularity measure comes from SteamSpy API. Finally, here is a reference to the NeoGAF post explaining the method, and the NeoGAF post explaining the idea behind the optimization of the only free parameter. The Python source code can be found on Github.

Reproducibility

To reproduce the results, use data downloaded betwe

@kylehounslow
kylehounslow / client.py
Last active April 23, 2024 10:58
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@mdonkers
mdonkers / server.py
Last active April 30, 2024 23:26
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@actuino
actuino / bt_speaker-raspberry_pi-zero_w.md
Last active April 19, 2024 04:57
Setting up a Bluetooth Speaker from the command line on a raspberry Pi Zero W

The setup of a bluetooth speaker on a Pi Zero W is pretty touchy.

Please get in touch via Twitter @actuino or http://www.actuino.fr/ if you've got comments or improvements to this quick draft.

First checks

  • Use a solid power source
  • check the speaker works on another hardware (android phone f.i.)
  • make sure you've updated your Raspbian, install and run rpi-update just in case.
@mattia-beta
mattia-beta / ddos.conf
Last active April 27, 2024 22:00
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###