Skip to content

Instantly share code, notes, and snippets.

View opabravo's full-sized avatar
🐯
Meowing

Fate Walker opabravo

🐯
Meowing
  • Universe Lania Kea Supercluster Virgo Cluster Local Group Milky Way Orion Arm Gould Belt Local Bubble Ben Interstellar Cloud Olnit Cloud Solar System Third Planet Earth
View GitHub Profile
@opabravo
opabravo / elearn.py
Last active June 12, 2022 05:45
A cog of my Multifunctional Discord BOT: "Elearning System on Discord"
"""
A cog of my Multifunctional Discord BOT: "Elearning System on Discord",
I think it's a good practice to prevent SQLIs in python codes,
by wrapping the queries with functions which only accept static type args,
also for explicit permission managing and safe structure...hope so :))
"""
import asyncio
import datetime
import io
@opabravo
opabravo / vps_secure_cheatsheet.md
Last active May 13, 2022 16:36
Cheatsheet to secure personal vps

Disable ICMP (Not a good practice though)

echo 'net.ipv4.icmp_echo_ignore_all = 1' >> /etc/sysctl.conf && sysctl -p

Setup Fail2banSnort

Use iptablesiptables-saveufw

Use Logwatch

Use htop

Check netstat

@opabravo
opabravo / free_space_for_linux.md
Last active February 23, 2025 07:36
CheatSheet to Check and clear space on linux
df -h
du -sch /* 2>/dev/null

# Install ncdu to check space usage
apt install ncdu -y
ncdu /

# clear compressed logs
find /var/log/ -type f -name "*.gz" -delete
@opabravo
opabravo / banip.sh
Last active May 12, 2022 05:23
Block an ip by iptables on linux
#! /bin/bash
function valid_ip()
{
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
@opabravo
opabravo / tip_absercer.py
Last active May 16, 2022 06:54
tip 自動請假
from bs4 import BeautifulSoup
import requests
import re
from datetime import date as now_date
from getpass import getpass
# from icecream import ic
class Tip:
@opabravo
opabravo / rps.py
Created July 18, 2021 04:25
十人猜拳
import random
from typing import Counter, List
class Player:
TRANSFER = ("剪刀", "石頭", " 布 ")
def __init__(self, name: str) -> None:
self.name = name
self.rnd_num = 0
@opabravo
opabravo / gist:c234e483daf4e41f2da1e0a61f9bd70a
Last active February 20, 2023 03:50
問卷評量自動打勾(吼好煩)
// Custom form embeded in iframe
var frame = document.getElementsByTagName('frame')[2]
var rd_btns = frame.contentDocument.querySelectorAll('input[type="radio"]')
for(var i=0;i<rd_btns.length;i++){
if(rd_btns[i].value=="C")
rd_btns[i].checked=true;
}
frame.contentDocument.GcpaForm.submit()
// Google Form
@opabravo
opabravo / hshy_checkin.py
Created July 31, 2019 00:27 — forked from ficapy/hshy_checkin.py
练手python脚本,登陆Discuz论坛打卡签到
# -*- coding: utf-8 -*-
import requests
import hashlib
import re
username = '' ###账号###
password = ''###密码###
UA = "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/27.0.1453.116 Safari/537.36"
headers = {
import discord
from discord.ext import commands
'''Turn every message into Big Text.'''
class Big:
def __init__(self, bot):
self.bot = bot