Skip to content

Instantly share code, notes, and snippets.

View Ivlyth's full-sized avatar
🎯
Focusing

Ivlyth Ivlyth

🎯
Focusing
View GitHub Profile
@Ivlyth
Ivlyth / excel.py
Last active August 29, 2015 14:26 — forked from gabemarshall/excel.py
Cracking a password protected excel doc with python
import sys
import win32com.client
openedDoc = win32com.client.Dispatch("Excel.Application")
filename= sys.argv[1]
password_file = open ( 'wordlist.lst', 'r' )
passwords = password_file.readlines()
password_file.close()
passwords = [item.rstrip('\n') for item in passwords]
@Ivlyth
Ivlyth / .gitignore
Created August 6, 2015 07:43
gitignore file
# Backup files
*.~
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
@Ivlyth
Ivlyth / query_diff_by_date.sql
Created August 3, 2015 07:56
查询每5分钟数据相对前一个时间点的变化情况
SELECT
*
FROM
(
SELECT
a.record_time time_a,
b.record_time time_b,
a.flow AS data_a,
b.flow AS data_b,
a.flow - b.flow AS data_diff,
@Ivlyth
Ivlyth / redis_profile_test.py
Last active August 29, 2015 14:26
test for operate on redis: set, mset, get, mget, hset, hmset, hget, hmget, hgetall
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Author : myth
Date : 15-7-28
Email : belongmyth at 163.com
'''
from datetime import datetime
from datetime import timedelta
@Ivlyth
Ivlyth / get_passwd_from_user_with_termios.md
Created July 28, 2015 07:56
get_passwd_from_user_with_termios

get passwd from user with termios

def getpass(prompt="Password: "):
    import termios, sys
    fd = sys.stdin.fileno()
    old = termios.tcgetattr(fd)
    new = termios.tcgetattr(fd)
    new[3] = new[3] & ~termios.ECHO          # lflags
 try:
@Ivlyth
Ivlyth / how_many_open_files.py
Created July 27, 2015 12:13
how_many_open_files
def how_many_open_files():
import psutil
pss = psutil.process_iter()
total_count = 0
for p in pss:
if p.num_fds() != len(p.open_files()):
print u'%s with pid %d has diff fds num %d and open files num %d'%(p.name, p.pid, p.num_fds(), len(p.open_files()))
total_count += len(p.open_files())
return total_count
@Ivlyth
Ivlyth / salt_cmd_run.py
Created July 27, 2015 09:25
salt cmdmod.py#run
def run(cmd,
cwd=None,
stdin=None,
runas=None,
shell=DEFAULT_SHELL,
python_shell=None,
env=None,
clean_env=False,
template=None,
rstrip=True,
@Ivlyth
Ivlyth / redis_publish_handler.py
Created July 22, 2015 06:43
redis publish handler for logging, copy from logging.handler.SocketHandler
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Author : myth
Date : 15-7-22
Email : belongmyth at 163.com
'''
import logging
import redis