Skip to content

Instantly share code, notes, and snippets.

View MartinLuksik's full-sized avatar

Martin Luksik MartinLuksik

View GitHub Profile
@MartinLuksik
MartinLuksik / java_install_sdk.sh
Last active March 2, 2024 23:07
[Java] Java #java
# Install JDK8:
sudo apt install openjdk-8-jdk
# If multiple java versions are installed you can switch between the versions:
sudo update-alternatives --config java
# See currently running java version
java -version
@MartinLuksik
MartinLuksik / pwsh_ad_groups.ps1
Last active January 20, 2024 21:46
[PowerShell] PowerShell #ps1 #pwsh #powershell
## Run shell as admin
## Enable scripts on your system
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
cd C:\Users\admmalu\Git\Infrastructure\UserManagement
.\AppPermGroupsCreateGroups.ps1 -shortAppName "GQL" -longAppName "GraphQL" -azureResource -aksResource -whatif
.\AppPermGroupsCreateGroups.ps1 -shortAppName "GQL" -longAppName "GraphQL" -azureResource -aksResource
## Disable scripts on your system
Set-ExecutionPolicy -ExecutionPolicy Restricted -Scope CurrentUser
@MartinLuksik
MartinLuksik / ansible_basics.sh
Last active September 10, 2023 12:50
[Ansible] Ansible #ansible
# grep modules
ansible-doc -l | grep docker
# one-off commands (ad hoc commands)
# ansible [pattern] -m modulename -a "module options"
ansible webservers -m service -a "name=httpd state=restarted"
ansible all -m firewalld -a "service=https permanent=yes state=enabled" -b
# use -b to elevate as root -> in playbook "become: yes"
# deploy nginx via a playbook
@MartinLuksik
MartinLuksik / acr.sh
Last active February 6, 2023 10:40
[Azure CLI] Azure CLI #az #azcli
az acr repository show --name btcsacr --image myapp:v1
# Unlocked it:
az acr repository update --name btcsacr --image myapp:v1 --write-enabled true --delete-enabled true
az acr repository update --name btcsacr --image myapp@sha256:436519e38d07508ed8e68214fea9824f4867009c185771fb3e5 --write-enabled true --delete-enabled true
@MartinLuksik
MartinLuksik / docker_bind_dns.sh
Last active September 16, 2022 08:03
[Docker] Docker #docker #dns $
# bind server with wildcard record
docker run -d -e WILDCARD_DNS='luksa=192.168.0.153' -p 80:53/udp martindocker22/bind:latest
# clean up disk with cron
#!/bin/bash
set -o xtrace
sudo sh -c '
cat << EOF > /etc/cron.d/docker_image_prune
0 2 * * * vsts /usr/bin/docker rm $(/usr/bin/docker ps --filter status=exited -q) > /tmp/docker_rm.log 2>&1
@MartinLuksik
MartinLuksik / git_basics.sh
Last active March 1, 2022 12:43
[Git] Git #git
git pull
# create and checkout
git checkout -b urls
# only checkout
git checkout urls
git add --all
git add ./myfile
git commit -m "message"
git push
git fetch

Create SA:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: martindev-sa
  namespace: kube-system

Get secret name and decode data:

@MartinLuksik
MartinLuksik / sql_basics.md
Last active May 29, 2023 12:43
[SQL] SQL #sql

SQL DB conn string secret example:

Data Source=<servername>.database.windows.net;Initial Catalog=<dbname>;User ID=<svcaccount>;Password=<PW>;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;MultipleActiveResultSets=true

Create new Service Account:

  • Master:
Create login svc_deploy with password = '';
@MartinLuksik
MartinLuksik / tf_basics.md
Last active January 27, 2024 23:09
[Terraform] Terraform #tf #terraform

TERRAFORM

PLAN

terraform plan -var location=switzerlandnorth -var environment=Test -var short_env=t -var short_location=sn

IMPORTS

#terraform import -var-file=../../shared.tfvars -var-file=../app_shared.tfvars
@MartinLuksik
MartinLuksik / basics.sh
Last active February 26, 2024 03:42
[Linux] Linux #sh #linux
# Kernel version of a Linux system
uname -a
# Check if lib is installed
ldconfig -p | grep libgtk
# Services
service <service name> status (old school)
systemctl status <service name>