Skip to content

Instantly share code, notes, and snippets.

View diggzhang's full-sized avatar
🎯
Focusing

digz diggzhang

🎯
Focusing
View GitHub Profile
@diggzhang
diggzhang / pymongocleandirtydocs.py
Created December 20, 2016 02:56
pymongo clean up docs
# -*- coding: utf-8 -*-
import sys
import pymongo
from pymongo import MongoClient
from datetime import datetime
import datetime
import json
from StringIO import StringIO
import time
from datetime import date
@diggzhang
diggzhang / batchConvertTimestampToReadableDatetime.py
Created February 15, 2017 06:22
batch convert timestamp to readable date time
from datetime import datetime
timestamp_list = [
1486137597659,
1486137597659
]
for timestamp in timestamp_list:
print(datetime.fromtimestamp(timestamp/1000))
#!/usr/bin/env bash
DB_HOST="10.8.2.97" && \
DB_NAME_EVENTS="eventsV4" && \
DB_COLLECITON_NAME="eventV4" && \
YEAR=$(date -d -1day '+%Y') && \
MONTH=$(date -d -1day '+%m') && \
DAY=$(date -d -1day '+%d') && \
#!/usr/bin/env python3
# coding: utf-8
# https://gist.github.com/diggzhang/37748f50be53cfdabc204dd87130b759
# 回复语,在发送群邀请后会回复这个
reply_text = """你好,如果您是我们歪友,欢迎加入我们歪歪群
"""
# 45min
@diggzhang
diggzhang / Communication.scala
Created September 13, 2017 03:13
Communication between actors
package com.packt.chapter1
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import scala.util.Random._
/**
* Which contains messages to be sent to the actors.
* Actors will use these messages for communication.
*/
object Messages {
@diggzhang
diggzhang / CustomMailbox.scala
Created September 13, 2017 03:44
actor mail box test code
package com.packt.chapter1
import java.util.concurrent.ConcurrentLinkedQueue
import akka.actor.{Props, Actor, ActorSystem, ActorRef}
import akka.dispatch.{MailboxType, ProducesMessageQueue, Envelope, MessageQueue}
import com.typesafe.config.Config
/**
* Created by user
*/
@diggzhang
diggzhang / PriorityMailBox.scala
Created September 13, 2017 04:17
PriorityMailBox code snip
package com.packt.chapter1
import akka.actor.{Props, ActorSystem, Actor}
import akka.dispatch.{PriorityGenerator, UnboundedPriorityMailbox}
import com.typesafe.config.Config
/**
* Created by user
*/
object PriorityMailBoxApp extends App {
@diggzhang
diggzhang / disk_manager.py
Created September 18, 2017 03:43
使用python监控磁盘容量
# coding:utf-8
"""
Monitor on the target disk
If disk usage out of limit bounds
Execute the cleanup operation
"""
import os
import psutil
@diggzhang
diggzhang / jar_pm.sh
Created September 21, 2017 03:58
jar package forever load script
# jar processing manager @diggzhang20170921
# */5 * * * * cd /home/master/event/ && /usr/bin/sh /home/master/event/jar_pm.sh
#!/usr/bin/env bash
# ##################################################
# Java Processing Manager
#
version="0.0.1"
author="[email protected]"
ability
ability_belonged
ability_scale
account
added_coins
answer
api
apk_sign
apk_url
app_duration