Skip to content

Instantly share code, notes, and snippets.

@Koboo
Koboo / BsonToBinary.java
Last active February 15, 2023 19:01
Just a static utility class to convert BSON Documents to byte-array and vice versa
import org.bson.BsonBinaryReader;
import org.bson.BsonBinaryWriter;
import org.bson.Document;
import org.bson.codecs.Codec;
import org.bson.codecs.DecoderContext;
import org.bson.codecs.DocumentCodec;
import org.bson.codecs.EncoderContext;
import org.bson.io.BasicOutputBuffer;
import java.nio.ByteBuffer;
# Docker networking is messy and undocumented. Docker will create IP addresses and iptables at random times.
# This can be limited by using totally static IP addresses for network interfaces and avoiding the default network bridge.
# /etc/default/docker
# DOCKER_OPTS="--iptables=false --ipv6 --bip 172.16.0.1/16 --fixed-cidr 172.16.0.0/16 --fixed-cidr-v6 2a01:9000::/68"
# --bip is the host IP address of the docker0 interface
# --fixed-cidr is the CIDR subnet allocated to the docker0 interface (default network bridge)
# --fixed-cidr-v6 is the IPv6 CIDR allocated to docker0
# for IPv6 split your /64 delegated subnet into /68 subnets and allocate them to each docker-compose.yml subnet:
@candlewill
candlewill / keras_models.md
Last active December 9, 2022 02:43
A collection of Various Keras Models Examples

Keras Models Examples

一系列常用模型的Keras实现

DNN

Multilayer Perceptron (MLP) for multi-class softmax classification

from keras.models import Sequential
@davydany
davydany / IPTABLES-CHEATSHEET.md
Last active March 19, 2024 21:29
IP Tables (iptables) Cheat Sheet

IP Tables (iptables) Cheat Sheet

IPTables is the Firewall service that is available in a lot of different Linux Distributions. While modifiying it might seem daunting at first, this Cheat Sheet should be able to show you just how easy it is to use and how quickly you can be on your way mucking around with your firewall.

Resources

The following list is a great set of documentation for iptables. I used them to compile this documentation.

@denji
denji / README.md
Last active April 24, 2024 17:20 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@MightyPork
MightyPork / usb_hid_keys.h
Last active April 23, 2024 21:20
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
anonymous
anonymous / abyss-as-a-service
Created November 20, 2015 14:56
Floating serenely through a peaceful abyss, a sigh escapes; content.
A siren wails, you're jolted from your respite
/dev/xsdb1 is at 100%
A cacophony of alerts screech from the phone.
Upset is the fragile balance, failure cascades.
Was only a matter of time.
Get some coffee.
All you ping seems to crumble, machine after machine fall; a massacre of uptime.
  • le.doot.generation: !
  • zewl.bot: .
  • chester.bot.doot.doot: $
  • steveice (interim): %
  • spongybot: #
  • totallynotfabbot: -
  • rob.the.bot: ?
  • wee.bot: `
  • hintss.bot: lol
@dandirks
dandirks / gist:05a6e2d22d38349263ed
Created March 7, 2015 21:05
Straw Poll - New Poll API
Make a POST with something like the following body to "http://strawpoll.me/api/v2/polls"
{
"title": "Poll title",
"options":[
"Option #1",
"Option #2",
"Option #3"
],
"multi": true,
@aadnk
aadnk / AnvilListener.java
Created April 13, 2014 00:44
Detect when anvils are broken by overuse.
package com.comphenix.example;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;