Skip to content

Instantly share code, notes, and snippets.

@x2c3z4
x2c3z4 / shapping-https.sh
Created November 4, 2021 05:31 — forked from xarg/shapping-https.sh
Limiting traffic with tc
#!/bin/bash
#
# tc uses the following units when passed as a parameter.
# kbps: Kilobytes per second
# mbps: Megabytes per second
# kbit: Kilobits per second
# mbit: Megabits per second
# bps: Bytes per second
# Amounts of data can be specified in:
# kb or k: Kilobytes
@x2c3z4
x2c3z4 / read.go
Created August 12, 2021 15:56 — forked from pfreixes/read.go
Test for checking maximum throughput of random reads over a 40GB file stored in a SSD disk
package main
import (
"fmt"
"math/rand"
"os"
"sync"
"time"
)
@x2c3z4
x2c3z4 / qcamerasvr_wrapper.sh
Created March 19, 2021 10:44 — forked from peat-psuwit/qcamerasvr_wrapper.sh
How to run a daemon and collect ftrace from it. (The example is mm-qcamera-daemon)
#!/system/bin/sh
echo 'function_graph' >/sys/kernel/debug/tracing/current_tracer
echo 96000 > /d/tracing/buffer_size_kb
echo $$ > /sys/kernel/debug/tracing/set_ftrace_pid
echo 1 > /sys/kernel/debug/tracing/tracing_on
(
sleep 10 # stop tracing after this second.
@x2c3z4
x2c3z4 / tasks.json
Created December 25, 2020 06:01 — forked from deadalusai/tasks.json
VS Code tasks.json for Rust/Cargo
/*
Before using this tasks.json you may like to consider trying the VS Code extension, `rust-lang.rust`
Marketplace: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Source: https://github.com/rust-lang/rls-vscode
*/
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
@x2c3z4
x2c3z4 / Makefile
Created October 17, 2020 03:28 — forked from kwilczynski/Makefile
Makefile for my Go projects (an example).
SHELL := /bin/bash
REV := $(shell git rev-parse HEAD)
CHANGES := $(shell test -n "$$(git status --porcelain)" && echo '+CHANGES' || true)
TARGET := packer-provisioner-itamae-local
VERSION := $(shell cat VERSION)
OS := darwin freebsd linux openbsd
ARCH := 386 amd64
@x2c3z4
x2c3z4 / Makefile
Created September 17, 2020 07:02 — forked from basharam/Makefile
Makefile template for Static library.
# Makefile template for Static library.
# 1. Compile every *.cpp in the folder
# 2. All obj files under obj folder
# 3. static library .a at lib folder
# 4. run 'make dirmake' before calling 'make'
CC = g++
OUT_FILE_NAME = libNAME.a
@x2c3z4
x2c3z4 / README.md
Created December 8, 2018 07:37 — forked from miguelmota/README.md
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@x2c3z4
x2c3z4 / delay.sh
Created May 24, 2018 09:40 — forked from digilist/delay.sh
Delaying network traffic to a specific IP
#!/bin/bash
interface=lo
ip=10.0.0.1
delay=100ms
tc qdisc add dev $interface root handle 1: prio
tc filter add dev $interface parent 1:0 protocol ip prio 1 u32 match ip dst $ip flowid 2:1
tc qdisc add dev $interface parent 1:1 handle 2: netem delay $delay
@x2c3z4
x2c3z4 / ss_att2.py
Created July 20, 2017 14:48
Shadowsocks attack
#!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
Copyleft (c) 2015 breakwa11
https://github.com/breakwa11/shadowsocks-rss
'''
import logging
import socket
@x2c3z4
x2c3z4 / list_gcp_iprange.sh
Created December 28, 2016 09:03 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#ipranges
#nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
dig txt $LINE +short
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n