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
| # !!!!!!!!!!!!!!!!!!!! | |
| # Before using this script stop the apiserver and ensure that there are no leases (etcdctl lease list). If there are any leases, revoke them first. | |
| # !!!!!!!!!!!!!!!!!!!! | |
| # You may need to: export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python | |
| import etcd3 | |
| # Replace with your etcd instance | |
| from_client = etcd3.client( | |
| host="127.0.0.1", |
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
| import java.util.*; | |
| import java.util.stream.Collectors; | |
| class ArrayBackedTreeMap<K,V> extends AbstractMap<K, V> { | |
| private final Map<K, Integer> tree = new TreeMap<>(); | |
| private final FixedIndexArrayList<V> values = new FixedIndexArrayList<>(10, 10); | |
| public V put(K k, V v) { | |
| Integer i = tree.get(k); |
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
| function base64Encode(data) | |
| local function encodeChar(n) | |
| if n <= 25 then | |
| return string.char(65 + n) | |
| end | |
| if n <= 51 then | |
| return string.char(97 + n - 26) | |
| end | |
| if n <= 61 then | |
| return string.char(48 + n - 52) |
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
| /** | |
| @param a The middlepoint coordinates and half extent sizes of the floating box (e.g. [x, y, z, w, h, d]) | |
| @param b The middlepoint coordinates and half extent sizes of the static box (e.g. [x, y, z, w, h, d]) | |
| @param v The "velocity" or "motion" vector that should be applied | |
| @return The "velocity" or "motion" vector that can be applied without overlapping | |
| */ | |
| function boxCollide(a, b, v) { | |
| // Find the amount of dimensions from the element count of a | |
| const dimCount = a.length / 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
| public class Test { | |
| public static void main(String [] args) { | |
| Integer age = Integer.parseInt(args[0]); | |
| switch(age) { | |
| case Integer x && x < 0: | |
| System.out.println("Not born yet!"); | |
| break; | |
| case Integer x && x < 18: | |
| System.out.println("Minor!"); |
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
| import io.kubernetes.client.common.KubernetesListObject; | |
| import io.kubernetes.client.common.KubernetesObject; | |
| import io.kubernetes.client.openapi.ApiClient; | |
| import io.kubernetes.client.openapi.models.*; | |
| import io.kubernetes.client.util.ClientBuilder; | |
| import io.kubernetes.client.util.KubeConfig; | |
| import io.kubernetes.client.util.credentials.AccessTokenAuthentication; | |
| import io.kubernetes.client.util.generic.GenericKubernetesApi; | |
| import io.kubernetes.client.util.generic.KubernetesApiResponse; | |
| import io.kubernetes.client.util.generic.options.CreateOptions; |
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
| #!/bin/bash | |
| echo "Password for Samba User 'snippets':" | |
| read -s smb_password_snippets | |
| echo "Password for S3 User 'admin':" | |
| read -s s3_password_admin | |
| echo "Password for S3 User 'dev' (min-length: 8):" | |
| read -s s3_password_dev | |
| echo "Password for S3 User 'api' (min-length: 8):" | |
| read -s s3_password_api | |
| wget -O /usr/local/bin/minio https://dl.min.io/server/minio/release/linux-amd64/minio |
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
| #!/bin/bash | |
| FILES="nonexistent" | |
| for f in ~/.kube/config.d/* | |
| do | |
| FILES="${FILES}:${f}" | |
| done | |
| KUBECONFIG=$FILES kubectl config view --merge --flatten > ~/.kube/config |
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
| AddEvent("OnKeyPress", function(key) | |
| if key ~= "U" then | |
| return | |
| end | |
| local vehicles = GetStreamedVehicles() | |
| local closest = nil | |
| local dist = 100000 | |
| local pX, pY, pZ = GetPlayerLocation() | |
| for i=1,#vehicles do | |
| local vX, vY, vZ = GetVehicleLocation(vehicles[i]) |
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
| local common | |
| AddEvent("OnPackageStart", function() | |
| common = ImportPackage("commonpackage") | |
| common.SomeFunction() | |
| end) |
NewerOlder