Skip to content

Instantly share code, notes, and snippets.

View haniokasai's full-sized avatar
📈
Studying Econometrics

haniokasai haniokasai

📈
Studying Econometrics
View GitHub Profile
IPVS on AWS EC2
ip_vs & ipvsadm
Note: ipvsadm is just the cli tools for interacting with the IP virtual server table in the kernel.
"ip_vs" is the kernel module that does the actual connection manipulating.
ipvsadm command options:
Either long or short options are allowed.
--add-service -A add virtual service with options
@jhit
jhit / letsencrypt-for-pure-ftpd.sh
Last active May 20, 2018 10:05
Taken from: https://www.howtoforge.com/community/threads/securing-ispconfig-3-control-panel-port-8080-with-lets-encrypt-free-ssl.75554/page-4#post-357460. What I'm actually using for pure-ftpd at the moment is the below script, run from a cronjob; rather than testing file timestamps it actually compares the certificate serial number handed out b…
#!/bin/bash
# letsencrypt-for-pure-ftpd.sh: compares the ssl certficate/key used by pure-ftpd
# with the current certificate/key issued by letsencrypt and copy the latter
# to the former if they differ.
# this can be run as a cronjob to propogate letsencrypt certificate changes
# to pure-ftpd
PUREFTPD_CERT=/etc/ssl/private/pure-ftpd.pem

Hub as a Gateway

Miners are required to have a public IP address and a properly configured firewall to make all things work properly. But sometimes it is not possible due to either security, privacy or provider limitations. This also includes miners behind the NAT.

To be able to work with these miners a Hub can be configured as a gateway.

Note: we assume that it is possible to build a private network between Hub and miners.

NAT

@larsch
larsch / install-arch-linux-rpi-zero-w.sh
Created July 6, 2017 06:05
Install Arch Linux ARM for Raspberry Pi Zero W on SD Card (with commands to configure WiFi before first boot).
#!/bin/sh -exu
dev=$1
cd $(mktemp -d)
function umountboot {
umount boot || true
umount root || true
}
# RPi1/Zero (armv6h):
@shoghicp
shoghicp / run.php
Last active September 26, 2020 10:33
Header Extractor - Usage: php run.php --input libminecraftpe.so --output headers/ --pointer-size 4 --asm
<?php
/**
* Minecraft: Pocket Edition header extractor
*
* This tool needs objdump (and objdump-multiarch + arm variants) installed on the current system
*
*/
const VERSION = "0.0.1";
@bytestree
bytestree / CustomAuthenticationFailureHandler.java
Last active November 22, 2019 16:32
UserService to return UserDetails object on authentication and implementation of AuthenticationSuccessHandler and AuthenticationFailureHandler
@Component("customAuthenticationFailureHandler")
public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
private String DEFAULT_FAILURE_URL = "/login?error";
@Autowired
private UserService userService;
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
@kmjones1979
kmjones1979 / nginx.conf
Created April 14, 2016 20:18
Example NGINX configuration to dynamically set the local IP address during socket creation
# Example of proxy_bind using variables using split_clients and map
events { worker_connections 2014; }
http {
default_type text/plain;
error_log /var/log/nginx/debug_error.log debug;
server {
<?php
public function onPacketSend(DataPacketSendEvent $e){
$pk = $e->getPacket();
$p = $e->getPlayer();
if($pk->pid() == 0xbf){
list($minX, $minZ, $maxX, $maxZ) = [0, 100, 0, 100];//これだと、0から100chunkだけ読み込まれるようになる
if($pk->chunkX < $minX or $pk->chunkX > $maxX or $pk->chunkZ < $minZ or $pk->chunkZ > $maxZ){
$e->setCancelled(true);
}
}elseif($pk->pid() == 0x95){
@onurguven
onurguven / vsftpd_virtualuser_add.sh
Created January 25, 2016 08:59
CentOS 7 bash script to create vsftpd user
#!/bin/bash
#------------------------------------------------------------------------------------
# Initialize some variables
#------------------------------------------------------------------------------------
SHELL=/sbin/nologin
FTPCONF=/etc/vsftpd
HOMEDIR=/var/www
@ohtomi
ohtomi / start_cgi_http_server.sh
Last active July 21, 2022 03:39
File Upload CGI Script written in Python
#!/bin/bash
mkdir ./cgi-bin/
cp upload.cgi ./cgi-bin/
chmod +x ./cgi-bin/upload.cgi
mkdir ./upload/
python -m CGIHTTPServer 8080