This file contains 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
# kubectl get pods | grep MyServiceName | while read -r line; do $line | awk '{print $1}' | kubectl delete pod $1; done | |
function delpods() { | |
local keyword=$1 | |
kubectl get pods | grep $keyword | while read -r line ; do | |
local containerName=$(awk -v var="$line" '{print $1}') | |
echo "Deleteing $containerName..." | |
kubectl delete pod $containerName | |
done | |
} |
This file contains 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
#Install Certbot and it’s Nginx plugin with apt | |
sudo apt install certbot python3-certbot-nginx |
This file contains 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 | |
# Install Prometheus | |
# | |
# Fail fast (set -e will bail at first error) | |
set -e | |
if [ "$EUID" -ne 0 ]; then | |
echo "ERROR: '$0' must be as root." | |
exit 1 |
This file contains 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
<?php | |
// 1. Register the routes | |
Route::get('test/{lorem}', function ($lorem) { | |
sleep(3); | |
return response()->json([ | |
'message' => $lorem, | |
'token' => Str::random(), | |
]); |
This file contains 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
sendFile(fileInput) { | |
let percentCompleted = 0; | |
let endpoint = '/store/uploads/here'; | |
const config = { | |
'Content-Type': 'multipart/form-data', | |
onUploadProgress: function(progressEvent) { | |
percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total); | |
console.log(percentCompleted); | |
} |
This file contains 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
use Illuminate\Support\Arr; | |
use Illuminate\Database\Eloquent\Relations\Relation; | |
use Illuminate\Support\Facades\Validator; | |
Validator::extend('poly_exists', function ($attribute, $value, $parameters, $validator) { | |
// usage: | |
// 'commentable_id' => 'required|poly_exists:commentable_type | |
if (! $type = Arr:get($validator->getData(), $parameters[0], false)) { | |
return false; |
This file contains 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 | |
ini_file=$(php -i | grep "Loaded Configuration File" | awk 'NR==1{print $5}') | |
php_version_output=$(php -v) | |
php_version=${php_version_output:4:3} | |
sudo pecl channel-update pecl.php.net | |
sudo pecl install swoole | |
sudo echo "extension=swoole.so" >> $ini_file | |
sudo service php$php_version-fpm reload |
This file contains 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 | |
# Forces an ntp update | |
# | |
# Based on SO user Martin Schröder's answer to "How to force a clock update | |
# using ntp?": http://askubuntu.com/a/256004/41943 | |
# Fail fast (set -e will bail at first error) | |
set -e | |
if [ "$EUID" -ne 0 ]; then |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am nickpoulos on github. | |
* I am nickpoulos (https://keybase.io/nickpoulos) on keybase. | |
* I have a public key ASD0uOGC1hFvUvgg67oWMe1iZWb0sLkY32qRPsVxAylmuAo | |
To claim this, I am signing this object: |