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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto3
import json
from datetime import datetime
import time
my_stream_name = 'test'
func AddJsonFormGormTag(in string) (string) {
var result string
scanner := bufio.NewScanner(strings.NewReader(in))
var oldLineTmp = ""
var lineTmp = ""
var propertyTmp = ""
var seperateArr []string
for scanner.Scan() {
oldLineTmp = scanner.Text()
||fireworktv.com
||v2ex.com
||wikipedia.org
||golang.org
||googlesource.com
||wireguard.com
||github.com
||gitlab.com
||gitlab-static.net
||tunsafe.com
{"sig":"12921da835011b96beef12fba4fac39254b96cbf76f3ce0fdb6d66d9a81d0091dbfb85d57fa79f8aa192f334a943584afb2090055cd5f51fb535b6d8d93fdf170","msghash":"986fb795b265c324c8d9357c55ef6ada2d4ce05f2f69e4bbd49371d159512bce"}
@xdays
xdays / tomcat-initscript.sh
Created August 20, 2015 15:00
tomcat init script for ansible
#!/bin/bash
#
# chkconfig: 345 99 28
# description: Starts/Stops Apache Tomcat
#
# Tomcat 7 start/stop/status script
# Forked from: https://gist.github.com/valotas/1000094
# @author: Miglen Evlogiev <bash@miglen.com>
#
# Release updates:
@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"""
@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 / 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 / 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 / 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>