Skip to content

Instantly share code, notes, and snippets.

Avatar
💜
Pony/JS/Lua

Manu Weidmann vyo

💜
Pony/JS/Lua
  • Germany
View GitHub Profile
@vyo
vyo / cleanup.sh
Created Aug 10, 2018 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
View cleanup.sh
#!/bin/sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@vyo
vyo / deployment-tool-ansible-puppet-chef-salt.md
Created Mar 29, 2018 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt
View deployment-tool-ansible-puppet-chef-salt.md

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@vyo
vyo / docker.service
Created Feb 14, 2018
systemd service file for Docker on Centos 7 (custom data directory)
View docker.service
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -g /data/docker \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current
@vyo
vyo / VectorMagnitude.md
Created Jan 26, 2018 — forked from karlgluck/VectorMagnitude.md
Approximate magnitude of 2d and 3d vectors
View VectorMagnitude.md

Vec3 Magnitude

These C# implementations of approximate magnitude with no square roots are actually slower than calling a native implementation in Unity, but if this were implemented intelligently in C there's a good chance they would be faster. In any case, they're here because it was a pain to get the magic numbers.

Accurate to within 4.5%.


public static float MagnitudeFast (this Vector2 self)
    {
@vyo
vyo / binaryHeap.moon
Last active Oct 25, 2017
Binary Heap for number values (Moonscript)
View binaryHeap.moon
logE = math.log(2)
logB = (value) ->
if value == 0 do return 1
return math.floor(math.log(value) / logE)
-- implementation of a binary minimum heap
-- use a function closure for instance creation
-- instead of tables
-- this yields us truly private variables and an
-- overall cleaner package
View crossBrowser_initKeyboardEvent.js
void function() {//closure
var global = this
, _initKeyboardEvent_type = (function( e ) {
try {
e.initKeyboardEvent(
"keyup" // in DOMString typeArg
, false // in boolean canBubbleArg
, false // in boolean cancelableArg
, global // in views::AbstractView viewArg
@vyo
vyo / codename_watsonkitty.swift
Last active Jul 10, 2017
Raw, Unsafe, Pointy: CapnSwifty Babysteps
View codename_watsonkitty.swift
// watsonkitty playground
import Cocoa
protocol CapnSwiftyReader {
}
protocol CapnSwiftyBuilder {
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sevenp.blog</groupId>
<artifactId>automagic</artifactId>
<version>0.1.0</version>
<dependencies>
View Util
public class Util {
/**
* Creates a custom ResourceConfig for use in Jersey Tests.
*
* Registers all resource/class definitions to be used in this test configuration.
*
* Optionally binds specifically configured instances to those definitions, e.g. mocks.
View ControllerTest.java
public abstract class ControllerTest<T> extends JerseyTest {
private Class<T> controllerClass;
private T controller;
private Map<String, Object> args;
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Override
You can’t perform that action at this time.