Skip to content

Instantly share code, notes, and snippets.

@Scrumplex
Scrumplex / 50-udisks.rules
Last active November 30, 2023 21:20
Polkit rules for udisks, and udisks2. Compatible with udiskie and Dolphin.
// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
@Gargron
Gargron / account-resolve-test.md
Last active December 19, 2022 05:46
An attempt to resolve an ActivityPub account from counter.social

The fundamental part of ActivityPub federation is the "actor", or in Mastodon terms, the account. Accounts from other servers are queried and saved into the local database to allow sending and receiving interactions. The ResolveRemoteAccountService class is responsible for this, working in two steps: Converting a human-readable handle like username@domain into URLs to the remote account's resources via Webfinger, and then using the linked remote account's JSON representation to create a local mirror.

Step 1: Webfinger

% curl -i "https://counter.social/.well-known/webfinger?resource=th3j35t3r@counter.social"
HTTP/1.1 200 OK
Date: Thu, 04 Jan 2018 03:29:01 GMT
Content-Type: application/jrd+json; charset=utf-8
Transfer-Encoding: chunked
@klzgrad
klzgrad / Traffic analysis survey.md
Last active March 17, 2024 09:49
流量分类调研

为什么流量可以进行分类

这里的“流量”一般定义为中间人观测到的一组由(时间,方向,包大小)元数据组成的序列 [Cai2014]。其源头是应用层的读写操作,经过传输层协议的变换(分片、协议状态机、加密等),流量序列产生一定变化。但是这种变化非常有限,因为流量的发生过程本质是确定性的,随机因素较小,因此对于特定环境中的特定应用(浏览器访问 google.com)各种流量特征体现出相当大的一致性和独特性,这就使“从流量特征识别应用”的监督学习问题成为可能。虽然有若干不利因素使得确定性下降,例如多层次上软件多版本的排列组合爆炸、有状态的缓存、流水线和连接复用、用户随机行为,但是因为版本的幂律分布、应用层读写操作间的依赖关系、流量特征和检测算法的改进等原因,分类依然具有相当的可行性。

分类的对象:流量应用分类与网站指纹攻击

根据分类的对象产生了两个相近但是不同的研究领域。从流量特征中分类应用类型的被称为流量分类(traffic classification),从流量特征中分类所访问网站或者网页的被称为网站指纹(website fingerprinting)。以机器学习的方法而论前者是比后者更弱但本质相同的一个问题。

这两类攻击的威胁类型不同。流量分类威胁的是可用性,如果GFW检出流量是隧道应用然后进行封锁,则破坏了可用性。而网站指纹威胁的是匿名性和隐私,如果从隐秘流量中检出是谁在访问哪个网站,则破坏了匿名性,丝绸之路就是这样被FBI破获的。

@mcxiaoke
mcxiaoke / sina-weibo-img.js
Created September 5, 2017 02:59
Weibo image url to author id
// ==UserScript==
// @name sinaimg
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *://*.sinaimg.cn/*
// @grant none
// ==/UserScript==
@kalxas
kalxas / README
Created July 23, 2016 00:15 — forked from gdamjan/README
Customize ubuntu live image
# first, get the iso from http://releases.ubuntu.com/
# make working dir hierarchy in /tmp (you'll need enough ram for this)
sudo mkdir -p /tmp/custom/{_squash,_work,iso,newiso,newlive,project}
sudo mount -o loop ~/Downloads/ubuntu-15.10-desktop-amd64.iso /tmp/custom/iso
sudo mount -t squashfs /tmp/custom/iso/casper/filesystem.squashfs /tmp/custom/_squash
sudo mount -t overlay overlay -onoatime,lowerdir=/tmp/custom/_squash,upperdir=/tmp/custom/project,workdir=/tmp/custom/_work /tmp/custom/newlive
# customize the live fs with systemd-nspawn (a better chroot)
sudo systemd-nspawn --bind-ro=/etc/resolv.conf:/run/resolvconf/resolv.conf --setenv=RUNLEVEL=1 -D /tmp/custom/newlive
@mondain
mondain / public-stun-list.txt
Last active May 5, 2024 18:13
Public STUN server list
23.21.150.121:3478
iphone-stun.strato-iphone.de:3478
numb.viagenie.ca:3478
s1.taraba.net:3478
s2.taraba.net:3478
stun.12connect.com:3478
stun.12voip.com:3478
stun.1und1.de:3478
stun.2talk.co.nz:3478
stun.2talk.com:3478
@agentzh
agentzh / default.custom.yaml
Last active May 11, 2019 16:07
Rime 五笔98输入法的配置。将下列文件拷贝到 Rime 配置目录(在 Mac OS X 上为 ~/Library/Rime/),然后点击屏幕右上角输入法的 Rime 图标,在出现的输入法菜单中点击 Deloy(或“布署”)菜单项即可生效。
patch:
schema_list:
- schema: wubi98 # 五笔98
@touilleMan
touilleMan / SimpleHTTPServerWithUpload.py
Last active May 4, 2024 01:08 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"