Skip to content

Instantly share code, notes, and snippets.

View hostmaster's full-sized avatar
:dependabot:
Drone pilot at work

Igor Khomyakov hostmaster

:dependabot:
Drone pilot at work
  • Sweden
  • 12:58 (UTC +02:00)
View GitHub Profile
@hostmaster
hostmaster / index.php
Created April 23, 2013 11:40
change nagios defaullt front page
<frameset cols="180,*">
<frame src="side.php" name="side" frameborder="0">
<!-- <frame src="main.php" name="main" frameborder="0"> -->
<frame src="/cgi-bin/nagios3/status.cgi?host=all" name="main" frameborder="0">
<noframes>
@hostmaster
hostmaster / gunicorn.conf
Created July 4, 2013 11:43
Just a simple Flask upload form
server {
listen 127.0.0.1:80;
server_name localhost;
access_log /var/log/nginx/gunicorn-access.log;
error_log /var/log/nginx/gunicorn-error.log debug;
location / {
try_files $uri @gunicorn_proxy;
}
#!/bin/bash
URL=http://www.mythic-beasts.com/cgi-bin/job.pl
curl -s ${URL} |
gawk '
/Evaluate/ {
gsub (/([[:alpha:]]|[[:space:]]|[,.<>/])/,"", $0);
print $0 |& "bc";
"bc" |& getline res;
@hostmaster
hostmaster / correct_xml.awk
Last active December 19, 2015 08:49
Correct malformed XML
#!/usr/bin/awk -f
BEGIN {
ss_start=0
ss_maybe=0
}
/<SS>/ {
ss_start=1
print $0
@hostmaster
hostmaster / set-pxe-ver.sh
Last active December 19, 2015 18:39
force version of pxe scripts to 124
awk '/_cube21/ { print tolower($1) }' /srv/ftp/pub/CentraStar/pxe/nodes | xargs -I % ln -f /tftpboot/pxelinux.cfg/default-124 /tftpboot/pxelinux.cfg/01-%
@hostmaster
hostmaster / vm-list-ip.sh
Last active December 20, 2015 07:39
Show ip addresses of running VMs
#!/bin/bash
VBoxManage list runningvms | sed -n -e 's/"\(.*\)" .*/\1/p'| \
while read vm; do
ip=$(VBoxManage guestproperty enumerate "${vm}" | awk '/V4\/IP/ { gsub(",", "", $4); print $4 }')
echo "\""$vm"\" IP:"$ip
done
import os
from flask import Flask, request, redirect, url_for
from werkzeug import secure_filename
UPLOAD_FOLDER = '/webroot/gunicorn/uploads'
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
- name: Set the hostname in rc.conf
lineinfile: dest=/etc/rc.conf regexp="^hostname" line='hostname="{{ hostname }}"'
register: hostnamestatus
- name: Set the hostname
command: hostname {{ hostname }}
when: hostnamestatus.changed
@hostmaster
hostmaster / clip_handler.py
Created July 31, 2013 17:32
A simple watcher for clipboard. Start a new download task if new magnet link detected.
#!/usr/bin/env python
#
#
import time
import re
import subprocess
import xerox
bt_cmd = "/usr/bin/qbittorrent"
#! /usr/bin/env python
import re
class Bob:
def hey(self, msg):
if msg is None or not msg.strip():
return 'Fine. Be that way!'
elif msg == msg.upper():