Skip to content

Instantly share code, notes, and snippets.

View YarekTyshchenko's full-sized avatar

Yarek T YarekTyshchenko

View GitHub Profile
@YarekTyshchenko
YarekTyshchenko / CruiseControl.cs
Last active January 16, 2023 23:45
Collection of Space Engineers C# Scripts
public class CruiseControl {
private double targetSpeed = 0.0;
private bool enabled;
private List<IMyThrust> thrusters = new List<IMyThrust>();
public void setTarget(double targetSpeed) {
this.targetSpeed = targetSpeed;
}
public void addThruster(IMyThrust thruster) {
this.thrusters.Add(thruster);
@YarekTyshchenko
YarekTyshchenko / Makefile
Created July 31, 2017 10:27
Makefile statsd instrumentation
STATSD_HOST ?= graphite.example.com
STATSD_PREFIX := development.makefile
# Start timer
# $(call start,test.counter)
define start
-@perl -MTime::HiRes=time -we"open my \$$f, '>', '._timing_$(1)'; print \$$f int time * 1000; close \$$f"
endef
# End timer, and send metric
# $(call end,test.counter)
define end
@YarekTyshchenko
YarekTyshchenko / clover-merge.php
Created February 1, 2016 14:07
Clover XML Merger
<?php
$options = getopt("f:o:");
if (! isset($options['f'])) {
echo "Files have to be specified with -f\n";
exit(1);
}
if (! isset($options['o'])) {
echo "Output has to be specified with -o\n";
exit(1);
}
@YarekTyshchenko
YarekTyshchenko / README.md
Last active May 13, 2016 09:48
Search for a makefile upwards recursively

Search Make

This is a script to recursively search for a Makefile deep in a project, and execute the first one that is found. Designed to be used in sublime_text build script:

{
    "shell_cmd": "~/search_make.sh rsync"
}
@YarekTyshchenko
YarekTyshchenko / fish_right_prompt.fish
Created March 9, 2016 13:41
Collection of Fish functions
function fish_right_prompt
if not set -q $DH
echo $DH
else
echo No Dockerhost set
end
end
@YarekTyshchenko
YarekTyshchenko / gist:b2a5b9dd42248f817037
Last active March 4, 2016 13:20
logspout docker snippet
docker rm -vf logspout
docker run -d --name logspout --restart=always --volume=/var/run/docker.sock:/tmp/docker.sock -p 8000:8000 gliderlabs/logspout:v2
# Then run in a shell:
curl http://${DOCKER_HOST:0:17}:8000/logs
# Connect to logspout log viewer
curl http://<ip_of_docker_host>:8000/logs
This file has been truncated, but you can view the full file.
;;; Provided courtesy of http://browscap.org/
;;; Created on Thursday, February 4, 2016 at 12:59 PM UTC
;;; Keep up with the latest goings-on with the project:
;;; Follow us on Twitter <https://twitter.com/browscap>, or...
;;; Like us on Facebook <https://facebook.com/browscap>, or...
;;; Collaborate on GitHub <https://github.com/browscap>, or...
;;; Discuss on Google Groups <https://groups.google.com/forum/#!forum/browscap>.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Browscap Version
@YarekTyshchenko
YarekTyshchenko / README.md
Last active February 2, 2016 17:19
Docker lsyncd script

Docker Lsyncd script

Usage:

sync {
    docker,
    source = ".",
 target="container:/path/in/container/",
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) %C(bold green)%ar%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset) - %C(white)%s%C(reset)' --all

Remove dangling images:

docker images -q --filter dangling=true | xargs docker rmi

Remove stopped containers:

docker ps -q --filter status=exited | xargs docker rm -vf