Skip to content

Instantly share code, notes, and snippets.

View Sharkrit's full-sized avatar

Sharky Impat Sharkrit

  • Ascend Money
  • Thailand
  • 02:40 (UTC +07:00)
View GitHub Profile
@Sharkrit
Sharkrit / test-bitbucket.sh
Created April 20, 2020 07:40
Test BitBucket
cat <<EOF > /tmp/test.txt
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
EOF
@Sharkrit
Sharkrit / nsenter_example
Created December 11, 2019 10:55
How to get inside Namespace using nsenter
# How to get inside Namespace using nsenter
nsenter -t <Pid> -n netstat -tunlb
docker ps | grep <name>
docker inspect <namespace> | grep
TBC
- description: Infrastructure as Code Rollout Deployment
executionEnabled: true
group: common/openshift
id: 67b0ca39-ea27-4668-9f8a-bb447244508a
loglevel: INFO
name: openshift-deploy-iac
nodeFilterEditable: false
options:
- description: Openshift Project Namespace
name: openshift-project
@Sharkrit
Sharkrit / ansible-rundeck.md
Created July 26, 2019 18:55 — forked from hvanderlaan/ansible-rundeck.md
ansible - rundeck, the poorman's ansible tower

Poor man's Ansible Tower

After a while of messing around with the free / demo version of Ansible Tower I thought that this could also be done with free tools. With some help from the internet and as an IT consultant I found the way forward.

As we all known Ansible is for free and is a package in the Ubuntu repository. Ansible Tower is a frontend for Ansible that will provide scheduler and a fancy webfrontend.

Rundeck is a job scheduler and runbook administration that is for free and also has a fancy webfrontend.

So for the poor man's solution we are going to use the best of both worlds.

POC

@Sharkrit
Sharkrit / Start-Sleep.ps1
Created January 4, 2018 04:38 — forked from ctigeek/Start-Sleep.ps1
Powershell sleep function, with progress bar.
function Start-Sleep($seconds) {
$doneDT = (Get-Date).AddSeconds($seconds)
while($doneDT -gt (Get-Date)) {
$secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds
$percent = ($seconds - $secondsLeft) / $seconds * 100
Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining $secondsLeft -PercentComplete $percent
[System.Threading.Thread]::Sleep(500)
}
Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining 0 -Completed
}
@Sharkrit
Sharkrit / Get-WindowsKey.ps1
Created June 25, 2017 06:32
Get-WindowsKey
function Get-WindowsKey {
## function to retrieve the Windows Product Key from any PC
## by Jakob Bindslet ([email protected])
param ($targets = ".")
$hklm = 2147483650
$regPath = "Software\Microsoft\Windows NT\CurrentVersion"
$regValue = "DigitalProductId"
Foreach ($target in $targets) {
$productKey = $null
$win32os = $null