Skip to content

Instantly share code, notes, and snippets.

View regme's full-sized avatar
🤠

Andrey Katamanov regme

🤠
View GitHub Profile
@regme
regme / openvpn.md
Created April 26, 2024 21:01 — forked from Morley93/openvpn.md
This is how you can take an openvpn .ovpn config file and extract the certificates/key required to import the profile into NetworkManager.

OpenVPN .ovpn manipulation.

This is how you can take an OpenVPN .ovpn config file and extract the certificates/keys required to import the profile into NetworkManager.

  • Download the .ovpn file. Save it somewhere you can store it permanently (I use ~/.vpn).
  • Copy from between <ca> tags into ca.crt, remove <ca> tags.
  • Copy from between <cert> tags into client.crt, remove <cert> tags.
  • Copy from between <key> tags into client.key, remove <key> tags.
  • Copy from between <tls-auth> tags into ta.key, remove <tls-auth> tags.
  • Remove the line "key-direction 1"
  • Above "# -----BEGIN RSA SIGNATURE-----" insert the following lines.
@regme
regme / New-PSObject.ps1
Created April 26, 2024 14:58
New-PSObject
function New-PSObject {
param(
$properties
)
return New-Object psobject -Property $properties;
}
$objects =
(New-PSObject @{
@regme
regme / gist:0fcf9a0960346f6a219ef34ce63cafd3
Last active November 16, 2022 12:21
docker/desktop-reclaim-space
docker system prune -f --all
wsl --shutdown
Optimize-VHD -path ${env:LOCALAPPDATA}\Docker\wsl\data\ext4.vhdx -Mode Full
@regme
regme / gist:d5acafef8905f581043e27e24cdf45e8
Last active July 9, 2021 13:03
dotnet-counters monitor
apt-get update && \
apt install wget apt-transport-https -y && \
wget https://packages.microsoft.com/config/ubuntu/20.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update && \
apt-get install -y dotnet-sdk-5.0 && \
dotnet tool install --global dotnet-counters && \
/root/.dotnet/tools/dotnet-counters monitor --process-id 1
@regme
regme / gist:c539cbfa761d0726237d115e1c13f963
Last active December 26, 2020 13:06
ElasticSearch SQL
POST /_sql/translate
{
"query": """SELECT * FROM "prod-iis-*" ORDER BY "sc-status" DESC""",
"fetch_size": 99999
}
===================================================
GET /_sql?format=csv
{
"query": """
@regme
regme / Latest-RC.ps1
Created November 6, 2020 13:28
Latest RC number
$rc = $(git branch --all| Select-String "/rc-\d+$" | sort { [int]($_ -replace '\D+') } | select -ExpandProperty Line -Last 1) -replace '\D+'
@regme
regme / latency.txt
Created May 25, 2020 08:27 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@regme
regme / docker-compose.yml
Created October 15, 2019 21:53
Local Development Environment
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.0
restart: always
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

@regme
regme / install-dotnet-hosting-2.2.6-win.ps1
Created August 14, 2019 18:26
Install .NET Core 2.2 Runtime & Hosting Bundle for Windows (v2.2.6)
Import-Module BitsTransfer
Start-BitsTransfer -source 'https://download.visualstudio.microsoft.com/download/pr/a9bb6d52-5f3f-4f95-90c2-084c499e4e33/eba3019b555bb9327079a0b1142cc5b2/dotnet-hosting-2.2.6-win.exe'
.\dotnet-hosting-2.2.6-win.exe /install /quiet /norestart