This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| class ListNode { | |
| int val; | |
| ListNode left; | |
| ListNode right; | |
| ListNode(int element) { | |
| val = element; | |
| left = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Solving valid paranthese with char array and topPtr - 10 min | |
| public boolean isValid(String s) { | |
| char[] charArr = new char[s.length()]; | |
| int topPtr = -1; | |
| // to add : charArr[+topPtr++] = c | |
| for (char c : s.toCharArray()) { | |
| switch(c) { | |
| case ')' -> { | |
| if (topPtr < 0 || charArr[topPtr] != '(') return false; | |
| topPtr--; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Configuration - REPLACE THE KEY BELOW | |
| $myPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQB+LaGHTTgSnLpudFXduMqSyYV4Jb+vYMISPPRcApSobOknsvYJv3NQIvtl1H3LxCtLF4mAoKD0AOdX8DgdksKDgyYonfX5hqRz76J35qxNMSZz4vqFVV/WvDPv37nPRgnZeTdCshfmqeie8Svc2ZGgaUt0LTRulYVK+AIfYHKaocQHUVgaCN5Ix1EWNPnOETvMdAnN2kgT1+j6h3fEBROABjQKcVPq8D+dW0o6Z/ut9pqH36Dwvz4P5S3Jx3/RArMpRuDrI87sdm3Y5sWWXbGb2cqoIrhs/aFUK3JYyLyIYQsjGvcro2nVEOE6+tAjecwr1rRjR3ZtJcFVc5zYpog6/4ccmaVTxOXY37e+MoPGksyDlwrncpf+7B6vCUmla6flC0aBsTAqpopJ+U4NS847r8rKxLkBm/nOmIlxk9P9UMXrQVBvbsZVxhhjS9jD0U6Jj8Fiy8fDPDDhApsIFxFQGm2OR65NVXAAdIMNYF51wDZTcldfYBC/IA9prqC4E= adityanath@MacBookPro.home" | |
| # 2. Install OpenSSH Server | |
| Write-Host "Installing OpenSSH Server..." -ForegroundColor Cyan | |
| Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 | Out-Null | |
| # 3. Start and Configure Service | |
| Start-Service sshd | |
| Set-Service -Name sshd -StartupType 'Automatic' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while($true) { | |
| Clear-Host | |
| Write-Host "--- TOP 15 PROCESSES (CPU USAGE) ---" -ForegroundColor Cyan | |
| Get-Process | Sort-Object CPU -Descending | Select-Object -First 15 -Property Name, Id, @{Name="CPU(s)";Expression={$_.CPU}}, @{Name="RAM(MB)";Expression={[math]::Round($_.WorkingSet / 1MB, 2)}} | Format-Table -AutoSize | |
| Write-Host "`n--- ACTIVE NETWORK CONNECTIONS ---" -ForegroundColor Yellow | |
| Get-NetTCPConnection -State Established | Select-Object LocalAddress, LocalPort, RemoteAddress, RemotePort, | |
| @{Name="Process";Expression={(Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue).Name}}, | |
| @{Name="PID";Expression={$_.OwningProcess}} | Select-Object -First 10 | Format-Table -AutoSize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Using any language, implement an assembler + simulator for a new assembly language that has the following characteristics: | |
| - Maintains a set of registers (can be thought of as variables) that store integers and can be used to move and process data via instructions | |
| - Instructions are executed sequentially | |
| - Instructions should support constant values for arguments in addition to registers | |
| here are some example instructions: | |
| add 45 5 ra # add 45 + 5, store result in ra | |
| add 10 rb rb # add 10 to rb, store in rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import azure.functions as func | |
| from azure.storage.blob import BlobServiceClient, BlobClient | |
| from io import BytesIO | |
| import zipfile | |
| def main(req: func.HttpRequest) -> func.HttpResponse: | |
| def copy_azure_blobs(srcName): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Azure.WebJobs; | |
| using Microsoft.Azure.WebJobs.Extensions.Http; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Logging; | |
| using Newtonsoft.Json; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| commitMsg = "Testing 101" | |
| changesList = [] | |
| for f_name in filesInZip: | |
| if f_name.split('.')[-1] in ['html', 'css', 'js', 'aspx', 'scss']: | |
| print("[+] Adding file: "+f_name) | |
| else: | |
| print("[+] Skipping file: "+ f_name) | |
| continue | |
| with open("/tmp/"+filename.split('.')[0]+"/"+f_name, "r") as fileContent: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mode = active | |
| output_directory = /Users/name/tools/amass | |
| maximum_dns_queries = 10000 | |
| [resolvers] | |
| monitor_resolver_rate = true | |
| resolver = 1.1.1.1 ; Cloudflare | |
| resolver = 8.8.8.8 ; Google | |
| resolver = 64.6.64.6 ; Verisign | |
| resolver = 74.82.42.42 ; Hurricane Electric |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def per_octal(perm_string): | |
| permStr = "" | |
| res = 0 | |
| for i in range(len(perm_string)): | |
| perm = perm_string[i] | |
| if perm == 'r': | |
| res += 4 | |
| elif perm == 'w': | |
| res += 2 | |
| elif perm == 'x': |
NewerOlder