This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git commit --allow-empty -m "Robot-CM: $(date)" && git push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git branch 2>/dev/null | grep '^*' | colrm 1 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %!python -m json.tool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Measure Powershell running time | |
| Measure-Command { $PATH_TO_PS_FILE.ps $PARAMETERS | Out-Host } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd /tmp | |
| wget -O git.zip https://github.com/git/git/archive/master.zip | |
| unzip git.zip | |
| cd git-* | |
| sudo apt-get install make autoconf libcurl4-gnutls-dev gettext gcc zlib1g-dev | |
| make configure | |
| ./configure --prefix=/usr --without-tcltk | |
| make all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #删除虚悬镜像 | |
| docker image prune --force | |
| #删除停止或一直处于已创建状态的实例 | |
| docker ps --filter "status=exited"|sed -n -e '2,$p'|awk '{print $1}'|xargs docker rm | |
| docker ps --filter "status=created"|sed -n -e '2,$p'|awk '{print $1}'|xargs docker rm | |
| #删除REPOSITORY是长uuid的镜像 | |
| docker images | sed -n -e '2,$p'|awk '{if($1 ~ /[0-9a-f]{32}/) print $1":"$2}'|xargs docker rmi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Join two list to a dict. | |
| var keys = new List<int> { 1, 2, 3 }; | |
| var values = new List<string> { "one", "two", "three" }; | |
| var dictionary = keys.Zip(values, (k, v) => new { Key = k, Value = v }) | |
| .ToDictionary(x => x.Key, x => x.Value); | |
| var lines = dictionary.Select(kvp => kvp.Key + ": " + kvp.Value.ToString()); | |
| Console.WriteLine(String.Join(Environment.NewLine, lines)); | |
| // Filter Pattern with Lamda to List |
The sample is implemented in Java to create a context manager as in Python. It provides open action by object constructor and offers automatically close through an AutoCloseable interface.
import org.openqa.selenium.WebDriver;
import java.util.Arrays;
import java.util.List;
public class FrameSwitcher implements AutoCloseable {
private WebDriver driver;
List<String> frameChain;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try { | |
| File file = new File("stderr.log"); | |
| FileOutputStream fos = null; | |
| fos = new FileOutputStream(file); | |
| PrintStream ps = new PrintStream(fos); | |
| System.setErr(ps); | |
| } catch (FileNotFoundException e) { | |
| e.printStackTrace(); | |
| } |
NewerOlder