Skip to content

Instantly share code, notes, and snippets.

@pisceanfoot
pisceanfoot / dict_merge.py
Created November 23, 2017 04:48
merge two dict into one
import copy
def merge(defaultConfig, configs):
new_config = copy.copy(defaultConfig)
if not configs:
return new_config
return _merge(new_config, configs)
def _merge(new_config, configs):
@pisceanfoot
pisceanfoot / process_watchdog.ps1
Created November 2, 2017 08:17
process watchdog
$programName = "RealTimeSync"
$isRunning = (Get-Process | Where-Object { $_.Name -eq $programName }).Count -gt 0
if(!$isRunning){
echo 'not found RealTimeSync'
Stop-Process -processname "RealTimeSync*"
Start-Process -FilePath "C:\Program Files\FreeFileSync\RealTimeSync.exe" -ArgumentList "E:\sync\Realtime.ffs_real" -WorkingDirectory "C:\Program Files\FreeFileSync"
exit
}
@pisceanfoot
pisceanfoot / install.sh
Created August 24, 2017 06:43 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@pisceanfoot
pisceanfoot / lettuce_log.py
Created August 24, 2017 04:05
display log in console for lettuce
import logging
import sys
root = logging.getLogger()
root.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
@pisceanfoot
pisceanfoot / git_pull.sh
Created August 24, 2017 03:52
pull all git repository from specific path
#!/bin/sh
code_path='/home/**/code_search'
git_pull() {
git_dir_name=$1
echo `pwd`/"$git_dir_name is a git repository."
git -C `echo` `pwd`/$git_dir_name remote | grep -n "origin"
# -*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals, \
with_statement
import calendar
from datetime import datetime
import json
import logging
import time
import types
@pisceanfoot
pisceanfoot / checkJenkins.sh
Created March 2, 2017 14:53 — forked from julianchurchill/checkJenkins.sh
A bash script to query a Jenkins server. Use like this: 'checkJenkins.sh <jobname>' and it will query the server with the given job name every 30s. Use like this: 'checkJenkins.sh <jobname> tmux' and it will query the server once and output tmux coloured messages appropriate to display in a tmux status bar. E.g. add this to your .tmux.conf 'set …
#!/bin/bash
CONSOLE_RED="\033[2;31m"
CONSOLE_GREEN="\033[2;32m"
CONSOLE_CLEAR="\033[0m"
JENKINS_SERVER=http://my_jenkins_server
JOB=$1
JOB_QUERY=/job/${JOB}
@pisceanfoot
pisceanfoot / README.md
Created March 2, 2017 02:15 — forked from sandfox/README.md
Jenkins Slave set-up script
@pisceanfoot
pisceanfoot / setup_selenium.sh
Created January 11, 2017 03:16 — forked from curtismcmullan/setup_selenium.sh
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in
@pisceanfoot
pisceanfoot / electron.cookie.js
Created December 18, 2016 13:02
get cookie from browser using electron