Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am yosida95 on github.
  • I am yosida95 (https://keybase.io/yosida95) on keybase.
  • I have a public key ASBAE6cx0BJc8BlIOyl_naNkt6w06Z0CmxDkvbc_ujetGgo

To claim this, I am signing this object:

@yosida95
yosida95 / supervisor_monitor.py
Last active May 22, 2020 14:46
Send email notifications on Supervisor programs died/failed/exited
#!/usr/bin/python
# -*- coding: utf-8 -*-
import contextlib
import signal
import sys
from email.mime.text import MIMEText
from datetime import datetime
from smtplib import SMTP
from threading import Event
@yosida95
yosida95 / gcounter.go
Created March 15, 2015 07:41
A G-Counter Implementation in Go (NOT TESTED)
// Copyright (c) 2015, Kohei YOSHIDA <license@yosida95.com>. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
@yosida95
yosida95 / config.py
Last active October 14, 2017 14:18
# -*- coding: utf-8 -*-
"""
Copyright (c) 2015, Kohei YOSHIDA <license@yosida95.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
~ ✘╹◡╹✘ dig @m.gtld-servers.net value-domain.com
; <<>> DiG 9.8.3-P1 <<>> @m.gtld-servers.net value-domain.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39649
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 5, ADDITIONAL: 5
;; WARNING: recursion requested but not available
contacts pushover
contact.pushover.command /path/to/pushover_munin.py
@yosida95
yosida95 / pushover_zabbix.py
Last active August 29, 2015 14:05
Notify you your zabbix events to your mobile devices via pushover.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import urllib2
from urllib import urlencode
APPTOKEN = YOUR_APPLICATION_TOKEN
cd $HOME
# Stop Zabbix Server (1.8)
sudo service zabbix-server stop
# Create a backup
mkdir ./zabbix-backup
mysqldump -uroot -p zabbix > ./zabbix-backup/dump.db
sudo cp /etc/zabbix/{apache.conf,zabbix_server.conf} ./zabbix-backup
sudo cp -r /etc/zabbix/alert.d ./zabbix-backup
# -*- coding: utf-8 -*-
from jsmapper import (
JSONSchema,
Array,
Mapping,
Number,
Object,
String,
)
# -*- coding: utf-8 -*-
from jsmapper import (
JSONSchema,
Mapping,
Number,
Object,
String,
)