Skip to content

Instantly share code, notes, and snippets.

View notsobad's full-sized avatar

notsobad notsobad

View GitHub Profile
@notsobad
notsobad / .gitlab-ci.yml
Created April 12, 2022 06:19
Use pylint in merge requests, only check the changed '.py' files in this MR.
stages:
- test
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
pylint-error-only:
stage: test
script:
@notsobad
notsobad / http408.py
Created January 26, 2021 06:39
HTTP 408
# python http408.py 127.0.0.1 80 25
import socket
import time
import sys
HOST = sys.argv[1]
PORT = int(sys.argv[2])
DELAY = int(sys.argv[3])
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#coding=utf-8
# https://zh.wikipedia.org/wiki/%E8%92%99%E6%8F%90%E9%9C%8D%E7%88%BE%E5%95%8F%E9%A1%8C
import sys
import random
stay = 0
change = 0
MAX_TRY = int(sys.argv[1])
for i in range(MAX_TRY):
docker run -v `pwd`:/data/ -e NODE_TLS_REJECT_UNAUTHORIZED=0 --rm -ti elasticdump/elasticsearch-dump \
--input=https://user:[email protected]/dir/ \
--input-index=index/type \
--searchBody="{\"query\":{\"term\":{\"key\": \"xxxx\"}}}" \
--output=/data/xxx.json \
--size=1000 \
--concurrency=5 \
--type=data
# https://askubuntu.com/questions/1049302/wired-ethernet-not-working-ubuntu-18-04
# ubuntu 18.04 桌面版,发现每次重启后,有线网络是off的状态,需要点击connect,才能连接,查了下,有不少人遇到同样问题,下面这个方法可以解决问题
service network-manager stop
rm /var/lib/NetworkManager/NetworkManager.state
service network-manager start
@notsobad
notsobad / Makefile
Created December 31, 2019 06:00
Makefile for start jupyter.
WORK_DIR = /root/notsobad/jupyter/work
CONTAINER_NAME = jupyter
init :
docker run -d --name $(CONTAINER_NAME) -p 8888:8888 -e NB_UID=1000 -e JUPYTER_ENABLE_LAB=yes -v "$(WORK_DIR)":/home/jovyan/work jupyter/tensorflow-notebook start-notebook.sh --NotebookApp.password='sha1:XXX:XXXX'
start :
docker start $(CONTAINER_NAME)
stop :
docker stop $(CONTAINER_NAME)
@notsobad
notsobad / filter-tls-1.0.sh
Created November 22, 2019 06:38
过滤tls1.0的client hello数据包
# 过滤tls1.0的client hello数据包,参考https://www.netmeister.org/blog/tcpdump-ssl-and-tls.html
tcpdump -ni eth0 '((tcp[((tcp[12] & 0xf0) >>2)] = 0x16) && (tcp[((tcp[12] & 0xf0) >> 2)+1] = 0x03) && (tcp[((tcp[12] & 0xf0) >> 2)+9] = 0x03) && (tcp[((tcp[12] & 0xf0) >> 2)+10] = 0x01))'