Skip to content

Instantly share code, notes, and snippets.

View xuanyuanaosheng's full-sized avatar

xuanyuanaosheng xuanyuanaosheng

View GitHub Profile
@xuanyuanaosheng
xuanyuanaosheng / install_node_exporter.centos6.sh
Created October 22, 2019 09:58 — forked from dale-c-anderson/install_node_exporter.centos6.sh
Install and configure Prometheus Node Exporter on a CentOS 6 box
#!/bin/bash
# Install Prometheus Node Exporter on CentOS 6.
set -eu
set -o pipefail
set -x
REPOFILE='/etc/yum.repos.d/coprs.ibotty.prometheus-exporters.repo'
INSTALLED=0
@xuanyuanaosheng
xuanyuanaosheng / gist:4ff7388e06c110929f2bec2d80742766
Created October 18, 2019 07:30 — forked from mancubus77/gist:447281619be3731461b73dd4a18593c5
Prometheus node exporter init.d (Centos6/RHEL6)
#!/bin/bash
#
# /etc/rc.d/init.d/node_exporter
#
# Prometheus node exporter
#
# description: Prometheus node exporter
# processname: node_exporter
# Source function library.
@xuanyuanaosheng
xuanyuanaosheng / ShadowSocks.sh
Created May 8, 2019 11:30 — forked from jingmian/ShadowSocks.sh
Ubuntu下安装ShadowSocks客户端
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-setuptools m2crypto
pip install shadowsocks
如果是ubuntu16.04 直接 (16.04 里可以直接用apt 而不用 apt-get 这是一项改进)
sudo apt install shadowsocks
nohup sslocal -c /opt/trainee/shadowsocks.json &
@xuanyuanaosheng
xuanyuanaosheng / autossh.service
Created April 24, 2019 09:37 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@xuanyuanaosheng
xuanyuanaosheng / docker_start.sh
Created March 16, 2019 11:08
容器启动脚本 在容器中挂载外部的应用并在容器启动的时候启动,参数传递使用环境变量 #bash #docker
nvidia-docker run -d --rm \
-e TZ=Asia/Shanghai \
-e AILAB_EXEC_SCRIPT="/etc/ailab-init/startup-vnc.sh#" \
-e USER_NAME=test \
-e LANG=zh_CN.UTF-8 \
-e RESOLUTION=1024x768x16 \
-v `pwd`/ailab-init:/etc/ailab-init \
--entrypoint bash \
-p 46080:8282 -p 45901:5900 \
-e VNC_PASSWORD=111111 \
@xuanyuanaosheng
xuanyuanaosheng / SMBDIS.ASM
Created February 6, 2018 10:23 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@xuanyuanaosheng
xuanyuanaosheng / nginx.conf
Created February 6, 2018 09:41 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@xuanyuanaosheng
xuanyuanaosheng / ss-go_att.py
Created November 28, 2016 03:35
Shadowsocks-go attack
#!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
Copyleft (c) 2016 breakwa11
https://github.com/breakwa11/shadowsocks-rss
'''
import socket
import traceback
@xuanyuanaosheng
xuanyuanaosheng / mysql2sqlite.sh
Created October 22, 2016 04:38 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@xuanyuanaosheng
xuanyuanaosheng / compild.py
Created August 24, 2016 09:54 — forked from alex-1q84/compild.py
使用python的sched和Timer执行定时任务
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sched, time
from threading import Thread, Timer
import subprocess
s = sched.scheduler(time.time, time.sleep)
class Job(Thread):