Skip to content

Instantly share code, notes, and snippets.

View ticapix's full-sized avatar

Pierre Gronlier ticapix

View GitHub Profile
#/bin/sh
SWIFTTOKEN=<token>
set -ex
tar -czf backup-www-`date +%F`.tar.gz $HOME/www
newestFile=`ls --time=ctime -1 backup-www*.tar.gz | head -n 1`
echo "New backup file $newestFile"
curl -i -T $newestFile -X PUT -H "X-Auth-Token: $SWIFTTOKEN" https://storage.sbg.cloud.ovh.net/v1/AUTH_008c2fc57c8f49e8bb8cbd61237bcb65/backup-members.gaia-x.eu/$newestFile
@ticapix
ticapix / gitlab-runner.sh
Created June 15, 2021 07:33
Small Gitlab runner from local .gitlab-ci.yml file
#!/bin/bash
set -e
which yq > /dev/null || (echo 'yq is missing, please install it. pip install yq'; exit 1)
cifile=".gitlab-ci.yml"
echo "Using file ${cifile}"
did:3:bafyreic4cizpwwnklbzzrxgmmfbde3mzt23vs4ultnon5keiutgz55hute

HELM 3

install Helm

sudo snap install helm --classic

add repo

#!/bin/sh
set -e
TERM=ansi
if [ $# -ne 1 ]; then
echo "usage: $0 <ngpus:int>"
echo "This script has to be executed on the t1-(45|90|180) VM directly"
exit 1
fi
@ticapix
ticapix / activate.sh
Last active October 29, 2019 16:46
K8s activate and deasctivate scripts
#!/bin/sh
ls `pwd`/kubeconfig.yml && export KUBECONFIG=`pwd`/kubeconfig.yml
export PATH=`pwd`:$PATH
export HELM_HOME=`pwd`/.helm
which curl > /dev/null 2>&1 || { echo "try apt-get install curl first"; return 1; }
which jq > /dev/null 2>&1 || { echo "try apt-get install jq first"; return 1; }
# KUBECTL
@ticapix
ticapix / vm.sh
Last active September 26, 2019 12:27
start / stop / getip from a VM on OVH Public Cloud. (default vm flavor is t1-45)
#!/bin/sh
set -e
. ./openrc.sh # download this config file from the api or the manager
for var in OS_AUTH_URL OS_IDENTITY_API_VERSION OS_TENANT_ID OS_USERNAME OS_PASSWORD OS_REGION_NAME; do
[ -z $( eval "echo \$$var" ) ] && (echo "Variable $var is undefined."; exit 1)
done
@ticapix
ticapix / Num2Word.xlsm
Created March 10, 2019 11:07
VBA module to convert a number to words, in Estonian.
## Usage: in a call, enter the formula `=SpellNumber(value)`. The cell will display the number in Estonian
Option Explicit
'Main Function
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = "tuhat, "
@ticapix
ticapix / export pdf.xlsm
Last active March 10, 2019 11:04
VBA code to export Excel spreadsheet to pdf file in local folder
## check if file already exists
Function FileExists(ByVal FileToTest As String) As Boolean
FileExists = (Dir(FileToTest) <> "")
End Function
## delete file if already generated
Sub DeleteFile(ByVal FileToDelete As String)
If FileExists(FileToDelete) Then 'See above
' First remove readonly attribute, if set
SetAttr FileToDelete, vbNormal