Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View xdays's full-sized avatar
🏠
Working from home

Xiangjun Zhang xdays

🏠
Working from home
View GitHub Profile
@xdays
xdays / python_cookies.py
Last active December 15, 2015 15:19
a basket of python tips
#input and raw_input
def input(prompt):
return (eval(raw_input(prompt)))
#convert one-dimensional list to dictionary
dict(enumerate(list))
#bidict one-to-one mapping data structure
b = bidict(dict)
b[key]
@xdays
xdays / github_card.html
Last active December 25, 2015 12:19
github card
<div class="github-card" data-user="xdays" data-width="300" data-height="150"></div>
<script src="http://lab.lepture.com/github-cards/widget.js"></script>
@xdays
xdays / pypod.md
Last active December 27, 2015 03:59 — forked from chuangbo/README.md

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

20130626

@xdays
xdays / mail.md
Last active December 28, 2015 18:19
two method to specify the sender with mail

two method to specify the sender:

  1. echo "This is the main body of the mail" | mail -s "Subject of the Email" recipent_address@example.com -- -f from_user@example.com

  2. mail -s "Some random subject" -a "From: some@mail.tld" to@mail.tld

@xdays
xdays / zabbix_web.conf
Created November 20, 2013 15:24
apache cofigure file for zabbix
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/local/zabbix-web
<Directory "/usr/local/zabbix-web">
Options FollowSymLinks
AllowOverride None
Order allow,deny
@xdays
xdays / zabbix_agent_linux_templates.xml
Last active December 29, 2015 15:19
Zabbix DiskIO template based on Template OS Linux
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-11-28T09:41:16Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
@xdays
xdays / zabbix_snmp_linux_templates.xml
Last active December 29, 2015 15:19
Zabbix DiskIO template based on SNMP
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-11-28T09:40:30Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
@xdays
xdays / php_fpm_check.py
Last active August 29, 2015 14:00
script to monior php-fpm, thanks to https://gist.github.com/wofeiwo/3720207
#!/usr/bin/env python
# pylint: disable=W0622
# Copyright (c) 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 Vladimir Rusinov <vladimir@greenmice.info>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@xdays
xdays / ldap_auth.py
Created May 14, 2014 02:07
python script for ldap authentication
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ldap
if __name__ == '__main__':
ldap_server='example.com'
base_dn = 'ou=user,dc=example,dc=com'
username = 'foo'
password = 'bar'
@xdays
xdays / ops_robot.py
Created May 20, 2014 02:16
a robot powered by jabberbot
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from jabberbot import JabberBot, botcmd
import datetime
class robot(JabberBot):
@botcmd
def serverinfo( self, mess, args):
"""Displays information about the server"""