Skip to content

Instantly share code, notes, and snippets.

View vyo's full-sized avatar
💜
Pony/JS/Lua

Manu Weidmann vyo

💜
Pony/JS/Lua
View GitHub Profile
@ctreffs
ctreffs / MemoryAddress.swift
Last active January 14, 2021 07:20
Memory address String of AnyObject instance in Swift
extension MemoryLayout where T: AnyObject {
/// Returns the memory address of the given instance.
/// - Parameter instance: The instance to inspect.
/// - Returns: A hex string representation of the memory address without leading zeros (e.g. `0x102f6dda0`).
@inline(__always)
public static func address(of instance: T) -> String {
"0x"+String(UInt(bitPattern: ObjectIdentifier(instance)), radix: 16, uppercase: false)
}
}
@superseb
superseb / cleanup.sh
Last active June 19, 2023 10:03
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
# OUTDATED: please refer to the link below for the latest version:
# https://github.com/rancherlabs/support-tools/blob/master/extended-rancher-2-cleanup/extended-cleanup-rancher2.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
// Find a "pivot" element in the array to compare all other
// elements against and then shift elements before or after
// pivot depending on their values
function QuickSort(arr, left = 0, right = arr.length - 1) {
let len = arr.length,
index
if(len > 1) {
index = partition(arr, left, right)
@jaceklaskowski
jaceklaskowski / deployment-tool-ansible-puppet-chef-salt.md
Last active January 3, 2024 22:12
Choosing a deployment tool - ansible vs puppet vs chef vs salt

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

@loverdos
loverdos / mvn-project-version.sh
Created May 20, 2015 10:07
Get maven project version from the shell
mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]'