Skip to content

Instantly share code, notes, and snippets.

@rubnet
rubnet / unwxapkg.py
Created June 25, 2023 09:54 — forked from Integ/unwxapkg.py
A useful tool for unpack wxapkg file with python3 surport.
# coding: utf-8
# py2 origin author lrdcq
# usage python3 unwxapkg.py filename
__author__ = 'Integ: https://github.com./integ'
import sys, os
import struct
class WxapkgFile(object):
@rubnet
rubnet / monitorSQL.sh
Last active December 17, 2021 03:24
keep mysqld alive
#!/bin/bash
pgrep mysqld
if [ $? -ne 0 ]
then
/etc/init.d/mysqld restart > /dev/null
fi
@rubnet
rubnet / .gitattributes
Created July 23, 2021 07:32 — forked from mezcel/.gitattributes
Alpine Linux Notes
## win10 line endins
*.bat eol=crlf
*.ps1 eol=crlf
## Linux/Posix line endins
*.go eol=lf
*.sh eol=lf
*.source eol=lf
Makefile eol=lf
@rubnet
rubnet / CentOS6-Base.repo
Last active July 20, 2021 11:24
1. Make a backup of the existing CentOS 6.10 Base repository file. cp -pr /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.OLD
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
"use strict";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, co
@rubnet
rubnet / upload.php
Last active December 19, 2019 04:07 — forked from taterbase/upload.php
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
# -*- encoding: utf-8 -*-
# Author: Epix
#
# Ban Xunlei IP for deluge
# This script will check deluge connected peers per 30 seconds.
# When an IP with UA in `BAN_PATTERNS` is found, the IP will be added to `BLOCK_LIST_FILE`.
# However if the IP is uploading or reporting 100% progress, it will say "WTF?"
import logging
@rubnet
rubnet / dmesg_ctime.sh
Last active October 6, 2019 03:54
Translate dmesg timestamps to human readable format
#!/bin/bash
# Translate dmesg timestamps to human readable format
# https://blog.sleeplessbeastie.eu/2013/10/31/how-to-deal-with-dmesg-timestamps/
# desired date format
date_format="%a %b %d %T %Y"
# uptime in seconds
uptime=$(cut -d " " -f 1 /proc/uptime)
@rubnet
rubnet / ApplicationContextHolder.java
Created September 22, 2019 11:10 — forked from ufuk/ApplicationContextHolder.java
Utility bean for getting Spring beans from static context.
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@rubnet
rubnet / sum_column
Last active October 28, 2019 06:40
sum column all number
str=``;
a=0;
str.trim().split('\n').forEach(e=>a+=Number(e.trim().split(/\s+/)[5].slice(0,-1)));
console.log(a);