Skip to content

Instantly share code, notes, and snippets.

View sjas's full-sized avatar
😆
EAX,60

sjas

😆
EAX,60
  • 755517,642095,1140
  • EDESTADDRREQ
View GitHub Profile
@sjas
sjas / rootfs_ubuntu_16.04_btrfs.md
Created June 24, 2018 21:17 — forked from niflostancu/rootfs_ubuntu_16.04_btrfs.md
Installing Ubuntu 16.04 on btrfs using debootstrap

Installing Ubuntu 16.04 with btrfs using debootstrap

Partition layout

First, create a GPT partition table.

  1. boot partition, label: EFI, flags: boot + ESP; size: 1GB, format to FAT32;
  2. root partition (label: root), must same size on all devices!
  3. swap partition.
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
class DotGenerator(Visitor):
def __init__(self):
super().__init__()
self.lines = []
self.next_id = 0
def make_name(self, node, name=None):
if name is None:
name = "n%d" % self.next_id
self.next_id += 1

channel operator quick reference

direct discussion about administrative action away from the main channel and into #reddit-diabetes-ops to minimise disruption. our -ops channel is the place where users should come to ask for our help. examples:

  • any sort of operator request or discussion of channel administration in the main channel
  • PMs asking why a ban was set
  • reports of harassment (unless the user is confiding in you)
  • any request for operator action

changing channel access permissions

@sjas
sjas / foo.md
Created August 29, 2018 05:04 — forked from sdstrowes/foo.md

tl;dr:

  • mostly, hosts ignore the mss sent
  • most of the interesting behaviour comes from the extremes: mss=1 and mss=1440
  • setting mss=(an atypical value, say 1275 or 1411) ought to spot hosts that simply reflect MSS values
  • setting mss=1024 apparently will spot a bunch of (Microsoft?) hosts returning MSS=956
  • passively, mss=1220, 1360, 1410 may help identify CDN/non-CDN nodes inside yahoo/edgecast, google, facebook respectively

Longer version: captured SYN+ACK+MSS values:

Variation is less than I initially thought; just enough for me to notice

@sjas
sjas / README.md
Created December 17, 2018 15:29 — forked from emschu/MIB_TREE_TO_JSON_TREE_README.md
Generate JSON OID Tree and catalog representation

This is an approach to generate dynamically a JSON representation of an OID tree (=an(y) SNMP MIB) using mibdump.py of python pysmi.

We will generate a flat list of OID objects (oid_catalog.json) + hierarchical json tree (oid_tree.json) with "."-separated nodes of RFC 1213 MIB.

1. Setup + get MIB(s) as JSON

$ pip install pysmi
# walk into and/or create a new directory you run the following command in
$ mibdump.py --destination-format=json --generate-mib-texts --build-index --mib-stub= RFC1213-MIB
import argparse
from mock import Mock
m = Mock()
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
query_group = subparsers.add_parser('query')
add_group = subparsers.add_parser('add')
@sjas
sjas / gist:bc31c3540509ac8d80a20b664a1d55c3
Last active March 3, 2019 12:11
a better manpage interface
m() {
dpkg -s dialog &>/dev/null || { echo "Needs 'dialog' package which is not installed on this system!" && return; }
[[ $# -lt 1 ]] && echo 'Man page name consisting of a single word expected but not given.' && return
MANPAGE=$1
[[ -n $2 ]] && DEFAULTCHOICE=$2 || DEFAULTCHOICE='0'
man $MANPAGE > /dev/null 2>&1 || { echo $MANPAGE man page not present on this system!; return; }
mapfile -t OUTLINE < <(PAGER=cat man $MANPAGE | grep ^\\w | grep -v -e AUTHORS -e COPYRIGHT | sed '1d;$d')
RESULTSIZE=$(echo ${#OUTLINE[*]})
CHOICE=$(
dialog --keep-tite --default-item "$DEFAULTCHOICE" --menu "$(
###################################################################################################################
# 0x00 - basics
###################################################################################################################
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
export PROMPT_COMMAND=echo
export PS0='\n'
export PS1='$( i=$?; if [ $i -eq 0 ]; then echo \\\[\e[32\;1m\\\]$i; else echo \\\[\e[31\;1m\\\]$i; fi )\[\e[0m\] \u@\h \[\e[33;1m\]\t\[\e[0m\] \w$(if git status 2>/dev/null | grep -q "nothing to commit"; then echo \\\[\e[32m\\\]; else if git status 2>/dev/null | grep -qi -e "^Changes not staged for commit" -e "^Untracked files:"; then echo \\\[\e[31m\\\]; else if git status 2>/dev/null | grep -q "to be committed"; then echo \\\[\e[36m\\\]; else echo \\\[\e[35\;1m\\\]; fi; fi; fi)$(__git_ps1)\[\e[0m\] \[\e[37;1m\]\$\[\e[m\]\[\e[36;1m\]$SHLVL \[\e[m\]\[\e[37;1m\]h\[\e[m\]\[\e[36;1m\]\! \[\e[m\]\[\e[37;1m\]c\[\e[m\]\[\e[36;1m\]\# \n\[\e[m\
10:15 <SoulRaven> i have this usb passthru
10:15 <SoulRaven> https://pastebin.com/8xrB1BTr
lxc.cgroup.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/004/002 dev/bus/usb/004/002 none bind,optional,create=file
lxc.mount.entry: /dev/ttyUSB0 dev/ttyUSB0 none bind,optional,create=file10:15
10:16 <SoulRaven> for a serial to usb converor
10:16 <SoulRaven> but i can't get it working right
10:16 <SoulRaven> when i do on cat: can't open '/dev/ttyUSB0': Operation not permitted