Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
vip=172.21.15.128
stime=15
run_wrk_short() {
echo "==== short connection: with $1 task, $2 connection =="
wrk2 -H "Connection: Close" -t $1 -c $2 -d 30s -R 30000 http://$vip --latency
sleep $stime
}
@fjrti
fjrti / qemu-vm
Created January 3, 2021 14:07
qemu
#!/bin/sh
#if use drive which if=ide, set root to /dev/sda1
#if use drive which if=virtio, set root to /dev/vda1
P9PATH=~/work/xxxx-repo/xxxx/test
~/work/qemu-run-arm64/qemu/aarch64-softmmu/qemu-system-aarch64 \
-s -cpu cortex-a57 -machine virt \
-trace enable=wd_dummy_v2_* \
@fjrti
fjrti / cidr.py
Created August 30, 2020 08:34
cidr list
# -*- coding: utf-8 -*-
from netaddr import IPNetwork
import click
@click.command()
@click.argument('cidr')
@click.option('--seperator', '-s', default=',', help='List seperator.')
@click.option('--file', '-f', default=False, help='txt file output path.')
@click.option('--range/--no-range', default=False, help='Output first and last IP Addresses')
@fjrti
fjrti / 256-color.sh
Last active March 15, 2019 01:21
256-color
#!/bin/bash
# Tom Hale, 2016. MIT Licence.
# Print out 256 colours, with each number printed in its corresponding colour
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163
set -eu # Fail on errors or undeclared variables
printable_colours=256
@fjrti
fjrti / chrome_patch_for_Surfingkeys.diff
Last active March 16, 2019 17:32
Surfingkeys support in Chrome reserved page
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index f637193e644f..60f9f5cd3644 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -147,6 +147,10 @@ void NavigatorImpl::CheckWebUIRendererDoesNotDisplayNormalURL(
->GetController()
->GetBrowserContext(),
url);
+ bool whitelistedSurfingkeys = url.host() == "gfbliohnnapiefjpjlpjnehglfpaknnc";
+ if (whitelistedSurfingkeys) {
https://github.com/git/git/tree/e83c5163316f89bfbde7d9ab23ca2e25604af290
@fjrti
fjrti / shell_bookmark.sh
Last active March 15, 2019 01:23
bookmark of shell
# USAGE:
# s bookmarkname - saves the curr dir as bookmarkname
# g bookmarkname - jumps to the that bookmark
# g b[TAB] - tab completion is available
# l - list all bookmarks
# save current directory to bookmarks
touch ~/.sdirs
function s {
cat ~/.sdirs | grep -v "export DIR_$1=" > ~/.sdirs1
function! SetCursorStyle()
if &term =~ "xterm\\|rxvt"
" use a | cursor in insert mode
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
" use a rectangle cursor otherwise
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\<Esc>]50;CursorShape=0\x7"
@fjrti
fjrti / crypt.c
Last active August 12, 2021 02:56
crypt加密
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define _XOPEN_SOURCE
int main(void)
{
char *passwd;
char key[] = "123456";
passwd = crypt(key, "$6$y9cP0qlmDYgBk6OZ$");
/*
** Copyright 2000
** by
** The Board of Trustees of the
** Leland Stanford Junior University.
** All rights reserved.
**
**
** Disclaimer Notice
**