Skip to content

Instantly share code, notes, and snippets.

View palaashatri's full-sized avatar
:shipit:
I may be slow to respond.

Palaash Atri palaashatri

:shipit:
I may be slow to respond.
View GitHub Profile
@palaashatri
palaashatri / hypervonwindowshome.bat
Created April 15, 2024 10:38
Install Hyper-V on Windows 10/11 Home. Run as Administrator.
@REM Simple batch script to download and install Hyper-V manager on devices running Windows 10/11 Home,
@REM so that you can run both Docker and a full-fledged, hardware-accelerated, virtualized OS alongwith Windows on this Type-1 hypervisor
@REM How to run?
@REM Open a conhost as administrator (in PowerShell, use "Start-Process cmd.exe -Verb runAs"), and then
@REM execute this script, simply by calling "hyper-v-on-windows-home.bat"
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
@palaashatri
palaashatri / Garbage-Collectors.md
Last active April 9, 2024 18:53
A theoretical overview of current state of GCs

Garbage Collectors

from "Really Understanding Garbage Collection - Gil Tene"

Introduction on GC in JVM, and how its different from memory operations in C++

  • GC is extremely efficient, more efficient than malloc(), costs less CPU if done right.
  • Dead objects cost nothing to collect. So do not set dead objects (during finalize() stage) to null, costs a lot more resources.
  • GC will find all dead objects (including cyclic graphs) and clean them.

Collector's operation

@palaashatri
palaashatri / tplink-archer-t4u.md
Created March 18, 2024 08:12 — forked from primaryobjects/tplink-archer-t4u.md
Steps to Install the TP-Link Archer T4U Plus AC1300 USB WiFi Adapter on Linux Mint
@palaashatri
palaashatri / areaCalculator.java
Created December 12, 2023 12:48
Area Calculator
/**
Area Calculator
Write a method named area with one double parameter named radius.
The method needs to return a double value that represents the area of a circle.
If the parameter radius is negative then return -1.0 to represent an invalid value.
Write another overloaded method with 2 parameters x and y (both doubles), where x and y represent the sides of a rectangle.
function allEven(arr){
// check if all are even numbers
return arr.every(num => {
return num%2 === 0;
}
);
}
// alt, check if all are even
const allEvens = (arr) => {return arr.every(num => {return num%2===0;});};
@palaashatri
palaashatri / swkotor-steam.ps1
Created October 16, 2023 11:15
Quick PowerShell script to configure SWKOTOR to run in Windowed mode.
$swkotorPath = "$env:ProgramFiles (x86)\Steam\steamapps\common\swkotor"
$swkotorIniPath = "$swkotorPath\swkotor.ini"
# Modify the configuration file
(Get-Content $swkotorIniPath) |
ForEach-Object { $_ -replace 'FullScreen=1', 'FullScreen=0' } |
Set-Content $swkotorIniPath
Add-Content $swkotorIniPath "`n[Graphics Options]`nAllowWindowedMode=1"
@palaashatri
palaashatri / matrix-operations.java
Last active June 12, 2023 05:58
[Java] Operation on Matrices
import java.util.Scanner;
public class App {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) throws Exception {
// program for matrix operations
System.out.println("Enter the operation to be performed : ");
System.out.println("1. Addition");
@palaashatri
palaashatri / new-windows-install.ps1
Last active May 8, 2024 07:43
My Windows Environment
# echo everything
$VerbosePreference = "Continue"
# escalate to administrator and install winget
# check if running as administrator
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# relaunch as administrator
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
Exit
@palaashatri
palaashatri / StaticBlock.java
Last active February 18, 2023 18:50
Simple demonstration of using Static blocks in Java
package testcache;
public class StaticBlock {
static String prometheusUrl = null;
static String billing_service_name = null;
static {
prometheusUrl = System.getenv("PROMETHEUS_URL");
if (prometheusUrl == null) {
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
This file will also available in other languages:
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html