Skip to content

Instantly share code, notes, and snippets.

View sonuame's full-sized avatar
😀
Life z good

Sunil sonuame

😀
Life z good
View GitHub Profile
@sonuame
sonuame / poco.sql
Created May 7, 2024 16:41
Sql to Poco
declare @TableName sysname = 'notification_responses'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
(
select
@sonuame
sonuame / kube.sh
Last active April 20, 2024 07:57
kubernetes installation for debian
apt-get update
# apt-transport-https may be a dummy package; if so, you can skip that package
apt-get install -y apt-transport-https ca-certificates curl gpg
# If the directory `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.
# sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list
@sonuame
sonuame / script.sh
Created March 29, 2024 12:50
Mac Remote Login Enable
sudo systemsetup -setremotelogin on
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu
@sonuame
sonuame / cybree-debian-upgrade-script.md
Created February 11, 2024 05:12 — forked from Bonveio/cybree-debian-upgrade-script.md
Cybree upgrade script (10 >> 11 >> 12 >> 13)

download script:

wget -O upgrade.sh 'https://gist.github.com/Bonveio/bb40b778b33ef06868c14c0240f25967/raw/upgrade.sh'

usage:

  • Debian 10 to 11 bash upgrade.sh 11
  • Debian 11 to 12 bash upgrade.sh 12
  • Debian 12 to 13 bash upgrade.sh 13
@sonuame
sonuame / SignupOrSignin.xml
Last active February 8, 2024 05:48
AzureAd-B2C Custom Policy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrustFrameworkPolicy
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.microsoft.com/online/cpim/schemas/2013/06"
PolicySchemaVersion="0.3.0.0"
TenantId="pitchnhireb2c.onmicrosoft.com"
PolicyId="B2C_1A_signup_signin_pnh_core"
PublicPolicyUri="http://pitchnhireb2c.onmicrosoft.com/B2C_1A_signup_signin_pnh_core">
@sonuame
sonuame / init.sh
Created February 2, 2024 09:21
USB-Cam-Streamer - Debian
sudo apt-get install -y v4l-utils
sudo v4l2-ctl -d /dev/video0 --list-formats-ext
@sonuame
sonuame / backup-restore-iis.cmd
Last active November 5, 2023 17:45
powershell-automations
setlocal
cd /d %~dp0
set backupdir=D:\iis\
%windir%\system32\inetsrv\appcmd list apppool /config /xml > %backupdir%\apppools.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > %backupdir%\sites.xml
rem RESTORE
%windir%\system32\inetsrv\appcmd add apppool /in < apppools.xml
@sonuame
sonuame / certbot.sh
Created July 27, 2022 07:30
Nginx DNS Challenge
sudo apt-add-repository ppa:certbot/certbot
sudo apt install certbot
wget https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py
chmod +x acme-dns-auth.py
nano acme-dns-auth.py
# change #!/usr/bin/env python to #!/usr/bin/env python3
sudo mv acme-dns-auth.py /etc/letsencrypt/
@sonuame
sonuame / Acquire-Token.cs
Created April 6, 2022 19:13
Azure Active Directory
public static void GetAuthorizationToken()
{
ClientCredential cc = new ClientCredential(AzureDetails.ClientID, AzureDetails.ClientSecret);
var context = new AuthenticationContext("https://login.microsoftonline.com/" + AzureDetails.TenantID);
var result = context.AcquireTokenAsync("https://management.azure.com/", cc);
if (result == null)
{
throw new InvalidOperationException("Failed to obtain the Access token");
}
AzureDetails.AccessToken = result.Result.AccessToken;
[Unit]
Description=ATS Backend APIs
StartLimitIntervalSec=0
[Service]
Environment=PORT=5555
Environment=LOG=true
ExecStart=node dist/main
WorkingDirectory=/var/local/ats-core
User=root