Skip to content

Instantly share code, notes, and snippets.

View mylamour's full-sized avatar
✌️
Do the right thing

Mour mylamour

✌️
Do the right thing
View GitHub Profile
@mylamour
mylamour / filterfilename.iced
Created December 28, 2017 01:40
filter file extention
allowed = ['.asp','.aspx','.jsp','.jspx','.php','.png','.jpg','.jpeg','.gif']
filebasename = os.path.basename path
findsuffixhit = (filebasename.indexOf(i) for i in allowed)
hitlen =findsuffixhit.filter((v) ->
if v != -1
return v
return
).length
# hitlen = findsuffixhit.filter(function(v){if(v!=-1){return v}})
@mylamour
mylamour / peewee.py
Last active January 5, 2018 03:17
peewee useage
#Dynamicly add field
# https://stackoverflow.com/questions/22358489/dynamically-define-fields-in-a-peewee-model
class FileProperty(Model):
filename = CharField()
my_field = peewee.IntegerField(null=False, default=0)
my_field.add_to_class(FileProperty, 'filetype')
FileProperty.filetype
@mylamour
mylamour / hardrule.py
Last active January 9, 2018 09:44
rulesgenerate
# from peewee import *
from peewee import Model, CharField, IntegerField, FloatField, DateTimeField, ForeignKeyField, PrimaryKeyField
from peewee import SqliteDatabase
from peewee import OperationalError, IntegrityError
from colorama import Fore,Style,Back
from uuid import uuid1
from sh import Command
import pprint
@mylamour
mylamour / osqueryiall.sh
Created January 10, 2018 02:00
osqueryi get sys info
tables=$(osqueryi --json ".tables" | awk -F "=>" '{print $2}')
for table in $tables
do
echo TableName $table
osqueryi --json "select * from $table" | python -m json.tool >> jsonunixsysinfo
done
#!/bin/bash
#Script From https://github.com/Nyr/openvpn-install
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS
# This script will work on Debian, Ubuntu, CentOS and probably other distros
# of the same families, although no support is offered for them. It isn't
# bulletproof but it will probably work if you simply want to setup a VPN on
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and

前言

Jekyll本机运行时有个问题,首页分页效果出不来.虽然是3.0版本,也去掉了permalink,加了pagination和pagination的路径,但是还是不行.就想干脆迁移到hexo吧

  • step1 :
npm install hexo-cli -g
hexo init blog
cd blog 
npm install
@mylamour
mylamour / raspberry zero.md
Created January 28, 2018 07:19
zero headless启动
  • headless启动,在boot分区下创建一个wpa_supplicant.conf填入以下内容。

我之前看到的教程没有ctrl这一块。

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
 ssid="xxxxxxxx
@mylamour
mylamour / cdh hue install .md
Created January 31, 2018 05:12
cdh hue install
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
sudo apt install libkrb5-dev
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev\nsudo apt-get install -y python-dev libldap2-dev libsasl2-dev libssl-dev
sudo apt install mysql-server
sudo apt-get install libmysqlclient-dev
make apps
  • [with EnvironmentError: mysql_config not found
@mylamour
mylamour / Slenium FAQ.md
Last active February 24, 2018 04:44
screenshot from browser

selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"} (Session info: headless chrome=64.0.3282.167) (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.13.0-32-generic x86_64)

不加http导致的

selenium.common.exceptions.WebDriverException: Message: Service . / chromedriver unexpectedly exited. Status code was: 127

yum install chromium

@mylamour
mylamour / multithreadingQthreadpool.py
Created March 12, 2018 02:04
PyQt demo script resources collections from internet
# https://martinfitzpatrick.name/article/multithreading-pyqt-applications-with-qthreadpool/
import sys
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QThreadPool, QObject, QRunnable, pyqtSignal
class WorkerSignals(QObject):
result = pyqtSignal(int)
class Worker(QRunnable):