Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View akkuman's full-sized avatar
💭
I may be slow to respond.

akkuman

💭
I may be slow to respond.
View GitHub Profile
@akkuman
akkuman / example.sh
Last active March 27, 2024 06:44
rockylinux 9 (epel) 切换国内源
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.sjtug.sjtu.edu.cn/rocky|g' \
-i.bak \
/etc/yum.repos.d/rocky*.repo && \
dnf makecache && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --enable devel && \
yum install -y epel-release && \
# https://github.com/tuna/issues/issues/1856
# https://help.mirrors.cernet.edu.cn/epel/?mirror=SJTUG-Siyuan
@akkuman
akkuman / README.md
Created March 21, 2024 09:51
爬取goby漏洞组件

来源: https://github.com/jiankeguyue/goby_spider

看了下源码,可以使用下面的转成csv

echo 'name,description,product,impact,recommendation,tags,name_en,description_en,product_en,impact_en,recommendation_en,tags_en,cve_id,fofa_query,asset_count,cvss,demo_gif_url,released_at' > goby.csv && curl -s 'https://gobysec.net/api/poc-push-list' | jq -r '.data|.[].push_data|.[] | [.name, .description, .product, .impact, .recommendation, .tags, .name_en, .description_en, .product_en, .impact_en, .recommendation_en, .tags_en, .cve_id, .fofa_query, .asset_count, .cvss, .demo_gif_url, .released_at|tostring] | @csv' >> goby.csv
@akkuman
akkuman / main.py
Created January 5, 2024 05:14
drf rest_framework_simplejwt 自定义加密密钥
import rest_framework_simplejwt.tokens
import rest_framework_simplejwt.settings
import rest_framework_simplejwt.backends
def generate_jwt_token(user, secret_key=''):
'''生成 jwt token'''
token: rest_framework_simplejwt.tokens.RefreshToken = rest_framework_simplejwt.tokens.RefreshToken.for_user(user)
token["role_id"] = str(user.role.pk)
token['username'] = user.email
token_backend = rest_framework_simplejwt.backends.TokenBackend(
@akkuman
akkuman / main.go
Created December 11, 2023 09:40
cobra 根据所给得某个参数动态添加参数
package cmd
import (
"context"
"expgo/pkg/errs"
"expgo/plugins"
"expgo/plugins/api/types"
"expgo/processor"
"fmt"
"os"
@akkuman
akkuman / run.sh
Created December 6, 2023 07:53
debian安装openjdk8(国内镜像)
# 安装jdk
# https://adoptium.net/zh-CN/installation/linux/#_deb_installation_on_debian_or_ubuntu
# https://mirrors.tuna.tsinghua.edu.cn/help/adoptium/
apt-get install -y wget apt-transport-https && \
mkdir -p /etc/apt/keyrings && \
(wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc) && \
(echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list) && \
apt-get update && apt-get install -y temurin-8-jdk
@akkuman
akkuman / 1555826334.txt
Created December 5, 2023 08:42 — forked from gastonfeng/1555826334.txt
PPA 镜像加速
PPA 镜像加速
2018年7月26日 BY : TATERLI
这里有USTC的反向代理.
https://lug.ustc.edu.cn/wiki/mirrors/help/revproxy
只要一句话,全替换成USTC加速的PPA.再也不担心了.
1
sudo find /etc/apt/sources.list.d/ -type f -name "*.list" -exec  sed  -i.bak -r  's#deb(-src)?\s*http(s)?://ppa.launchpad.net#deb\1 http\2://launchpad.proxy.ustclug.org#ig' {} \;
@akkuman
akkuman / Dockerfile
Last active March 12, 2024 06:33
go+docker-compose 开发容器样例
FROM mcr.dockerproxy.com/devcontainers/go:1-1.22-bullseye
# 如果在国外
# FROM mcr.microsoft.com/devcontainers/go:1-1.22-bullseye
ARG DEBIAN_FRONTEND=noninteractive
ARG USER=vscode
RUN sed -i "s|http://deb.debian.org/debian|http://mirror.sjtu.edu.cn/debian|g" /etc/apt/sources.list && \
apt-get update && \
apt-get install -y bash-completion direnv
@akkuman
akkuman / Dockerfile
Created November 8, 2023 01:13
poetry poetry 项目 Dockerfile
# syntax=docker/dockerfile:experimental
FROM python:3.9.5-buster as base
ENV POETRY_HOME=/opt/poetry
RUN python3 -m venv $POETRY_HOME && \
python3 -m pip install --upgrade pip -i https://mirror.sjtu.edu.cn/pypi/web/simple && \
$POETRY_HOME/bin/pip install poetry==1.2.2 -i https://mirror.sjtu.edu.cn/pypi/web/simple && \
$POETRY_HOME/bin/poetry --version && \
python3 -m pip install --no-cache-dir --no-compile wheel -i https://mirror.sjtu.edu.cn/pypi/web/simple
@akkuman
akkuman / README.md
Last active October 25, 2023 08:33
前端项目构建时自动更新csp

先安装 csp-hash

npm install github:apaatsio/csp-hash-from-html
@akkuman
akkuman / Dockerfile
Last active October 25, 2023 09:08
前端项目Dockerfile
FROM --platform=linux/amd64 node:12-alpine as build
USER node
WORKDIR /app
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global \
PATH=$PATH:/home/node/.npm-global/bin
COPY package*.json ./
RUN npm install -g mirror-config-china --registry=https://registry.npmmirror.com && \