Skip to content

Instantly share code, notes, and snippets.

View giskou's full-sized avatar
👹

Giannis Skoulis giskou

👹
View GitHub Profile
@giskou
giskou / StartKubelet.ps1
Created June 3, 2020 09:09
StartKubelet.ps1 from kubernetes-sigs/sig-windows-tools with some added docker cleanup.
$FileContent = Get-Content -Path "/var/lib/kubelet/kubeadm-flags.env"
$global:KubeletArgs = $FileContent.Trim("KUBELET_KUBEADM_ARGS=`"")
$netId = docker network ls -f name=host --format "{{ .ID }}"
if ($netId.Length -lt 1) {
docker network create -d nat host
}
if ( (docker ps -q | Measure-Object -line).Lines -eq 0 ) {
@giskou
giskou / cleanup.sh
Last active February 19, 2020 08:27 — forked from superseb/cleanup.sh
Cleanup host added as custom to Rancher 2.0
#!/usr/bin/env sh
sudo systemctl stop docker.service
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke /var/lib/docker"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
sudo systemctl start docker.service
@giskou
giskou / shell-info-docker-vm-windows.sh
Last active January 23, 2020 09:29 — forked from jongio/ssh-info-docker-vm-windows.sh
Get shell with root access to the VM that runs Docker on your Windows host.
#!/usr/bin/env bash
exec docker run --privileged --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/local/bin/docker:/usr/local/bin/docker alpine docker run --net=host --ipc=host --uts=host --pid=host -it --security-opt=seccomp=unconfined --privileged --rm -v /:/host alpine chroot /host
@giskou
giskou / container_exists.sh
Created December 19, 2019 13:47
Check if azure storage container exists
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
set -euf -o pipefail
storage_account="$1"
container_name="$2"
access_key="$3"
# HTTP Request headers
@giskou
giskou / sms.sh
Created May 28, 2019 07:44
Send SMS with Telia.no
#!/usr/bin/env bash
set -euxo pipefail
SMS_AUTH_URL='https://min-side.telia.no/re/api/mssa-proxy/no/rs/auth/basic'
SMS_SEND_URL='https://min-side.telia.no/re/api/mssa-proxy/no/rs/messaging/sms/send'
CREDS=~/.secret/sms
SESSION=~/.cache/sms/session
@giskou
giskou / downsize_azure.sql
Created December 4, 2018 11:35
Downscale azure
-- https://community.dynamics.com/crm/b/crmchap/archive/2018/05/20/an-unexpected-error-occured-while-processing-the-request-error-when-downscaling-an-azure-sql-database
SET NOCOUNT ON
DECLARE @CurrentFileSize INT, @DesiredFileSize INT, @ShrinkChunkSize INT, @ActualSizeMB INT,
@ErrorIndication INT, @dbFileID INT = 1, @LastSize INT, @SqlCMD NVARCHAR(MAX),
@msg NVARCHAR(100)
/*Set these values for the current operation, size is in MB*/
SET @DesiredFileSize = 350000 /* filesize is in MB */

Keybase proof

I hereby claim:

  • I am giskou on github.
  • I am giskou (https://keybase.io/giskou) on keybase.
  • I have a public key ASBMjP49FyLgQhKy9t6NnwyPzFLx6fTDEhaiu0Fy6tvnxQo

To claim this, I am signing this object:

@giskou
giskou / azure_ips.sh
Last active March 16, 2017 15:51
Get all azure public IP ranges
curl -s https://www.microsoft.com/en-us/download/confirmation.aspx?id=41653 \
| grep 'mscom-link failoverLink' \
| egrep --only-matching 'http.*xml' \
| xargs curl -s \
| egrep --only-matching '(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))'
@giskou
giskou / disk.sh
Last active February 13, 2017 14:30
Set up disk
#!/usr/bin/env bash
mkdir $2
echo "Partitioning $1"
echo -e "n\np\n1\n\n\nw" | fdisk "$1"
echo "Formating $1"
mkfs.ext4 "$1"1
UUID=`blkid | grep "$1" | egrep -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}'`
echo "UUID=$UUID $2 ext4 defaults 1 2" >> /etc/fstab
echo "Mounting $1 on $2"
@giskou
giskou / SSLPoke.java
Created June 28, 2016 08:51 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the commet #1 for howto.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {