Skip to content

Instantly share code, notes, and snippets.

View KITSAlexBrown's full-sized avatar

Alex Brown KITSAlexBrown

  • @KITSGitHubAdmin @stump201
  • London
View GitHub Profile
@KITSAlexBrown
KITSAlexBrown / install_webdriver.sh
Created April 8, 2019 11:42 — forked from devisnotnull/install_webdriver.sh
REHL/CentOS install chrome driver binary
#!/bin/sh
yum update -y
yum install -y wget unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
yum install -y ./google-chrome-stable_current_*.rpm
curl https://chromedriver.storage.googleapis.com/73.0.3683.20/chromedriver_linux64.zip > ~/chromedriver.zip
unzip -o ~/chromedriver.zip -d /usr/local/bin/chromedriver
@KITSAlexBrown
KITSAlexBrown / install.txt
Created April 5, 2019 09:01 — forked from xiaol825/install.txt
How to install Chrome, ChromeDriver and Selenium on CentOS. Plus a sample scraping script.
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@KITSAlexBrown
KITSAlexBrown / Jenkinsfile
Created February 20, 2019 10:26 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
@KITSAlexBrown
KITSAlexBrown / multiRotate.swift
Created September 25, 2018 16:57
Swift rotate angle from two touch points
/**
Essentially using the first and second finger points in conjunction with the screenview we can calculate the angle in
radians that we are going to use for the rotation.
We need the initial angle of the gesture to calculate the offset in all following gestures,
P = atan2(Y,X) returns the four-quadrant inverse tangent (tan-1) of Y and X, which must be real.
```
Example
atan2(4,-3)
ans = 2.2143
```
@KITSAlexBrown
KITSAlexBrown / unity.xcconfig
Last active September 14, 2018 13:25
Unity IOS ARKit xcconfig
//
// Unity.xcconfig
//
// Created by Adam Venturella on 10/28/15.
// Settings from http://www.the-nerd.be/2015/08/20/a-better-way-to-integrate-unity3d-within-a-native-ios-application/
UNITY_RUNTIME_VERSION = 2018.2.5f1;
UNITY_SCRIPTING_BACKEND = il2cpp;
UNITY_IOS_EXPORT_PATH = ../ios_build;
GCC_PREFIX_HEADER = $(UNITY_IOS_EXPORT_PATH)/Classes/Prefix.pch;
@KITSAlexBrown
KITSAlexBrown / delete-from-v2-docker-registry.md
Created September 3, 2018 14:09 — forked from jaytaylor/delete-from-v2-docker-registry.md
One liner for deleting images from a v2 docker registry

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
@KITSAlexBrown
KITSAlexBrown / cleanup.sh
Created September 3, 2018 10:55 — forked from paulrobello/cleanup.sh
Docker registry v2 cleanup script
#!/bin/bash
### your registry must have the following environment var set
# REGISTRY_STORAGE_DELETE_ENABLED=true
### replace YOUR_SERVER with corect info
REGISTRY_URL=https://YOUR_SERVER:5000
### host registry volume folder
REGISTRY_ROOT=/registry
### container to execute garbage-collect
CONTAINER_NAME=services_registry.1
139
down vote
accepted
TL;DR - go to the bottom of the answer, "Applying the restrictions"
Adding a restricted user consists of two parts: 1. Creating the user 2. Configuring the SSH daemon (sshd)
Configuring sshd
The best place to get known to the possibilities of SSH is by reading the related manual pages:
@KITSAlexBrown
KITSAlexBrown / ifup.sh
Created July 22, 2018 11:15
Bring up interface
#!/bin/sh
set -x
switch=br0
if [ -n "$1" ];then
# tunctl -u `whoami` -t $1 (use ip tuntap instead!)
ip tuntap add $1 mode tap user `whoami`
ip link set $1 up
sleep 0.5s
@KITSAlexBrown
KITSAlexBrown / create-openvpn.sh
Created July 22, 2018 11:13
Ubuntu create openvpn server
#!/bin/bash
#
# https://github.com/Nyr/openvpn-install
#
# Copyright (c) 2013 Nyr. Released under the MIT License.
# Detect Debian users running the script with "sh" instead of bash
if readlink /proc/$$/exe | grep -q "dash"; then
echo "This script needs to be run with bash, not sh"