Skip to content

Instantly share code, notes, and snippets.

@soof-golan
soof-golan / Dockerfile
Last active April 26, 2024 03:12
Python + Poetry + Docker Example
FROM python:3.10 as python-base
# https://python-poetry.org/docs#ci-recommendations
ENV POETRY_VERSION=1.2.0
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
# Tell Poetry where to place its cache and virtual environment
ENV POETRY_CACHE_DIR=/opt/.cache
@shafinmahmud
shafinmahmud / jdk-remove.txt
Last active April 26, 2024 03:07
Completely Remove JAVA from Linux
Clean previous JVMs
-------------------
1. Remove all the Java related packages (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove
2. Purge config files:
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
3. Remove Java config and cache directory:
@kreig303
kreig303 / shell-out.ps1
Last active April 26, 2024 03:05
Powershell aliases for git and npm
##
# POWERSHELL SPECIFIC
##
Set-Alias clr clear # slight contraction of clear command
function brc { Start notepad "C:\Users\kzimmerman012\Documents\PowerShell\profile.ps1" } # for editing this file
function Reload-PowerShell { Start-Process pwsh; exit } # reload PowerShell Core
Set-Alias relo Reload-PowerShell
function lw { dir | fw } # wide listing
function up { cd .. } # better back
function rmraf { Remove-Item -Recurse -Force $args[0] }
@wojteklu
wojteklu / clean_code.md
Last active April 26, 2024 03:00
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@fuji246
fuji246 / tcp_cubic_memo.md
Last active April 26, 2024 02:54
TCP cubic memo

Paper

use a cubic function to replace the linear window growth to improve performance in high BDP network, also achieved RTT fairness.

tcp-cubic is succssor of tcp-bic, tcp-bic use binary search to find the avialble bandwidth when congestion happens, and MAY enter an lieaner increasing state (Additive Increase)if it dropped too low, if it passed the maximum window, it goes into max probing state and will do the reverse and grow slowly initially and switch to additive increase if it can't find new maximum window nearby.

@j-jith
j-jith / miui-fastboot-howto.rst
Last active April 26, 2024 02:38
How to flash MIUI Fastboot ROM from Linux

How to flash MIUI Fastboot ROM from Linux

Function Initialize-EC2Disk {
param(
[parameter (mandatory=$true)][string] $InstanceId
)
$Commands = @(
'Get-Disk | `
Where partitionstyle -eq "raw" | `
Initialize-Disk -PartitionStyle MBR -PassThru | `
New-Partition -AssignDriveLetter -UseMaximumSize | `
Format-Volume -FileSystem NTFS -Confirm:$false -force'
Function Get-Device() {
param(
[parameter (mandatory=$true)][string] $InstanceId
)
$CurrentDevice = Get-EC2InstanceAttribute $InstanceId -Attribute blockDeviceMapping | Select-Object -ExpandProperty BlockDeviceMappings | Select-Object -last 1
If ($CurrentDevice.DeviceName -eq '/dev/sda1') {
$NewDevice = 'xvdf'
return $NewDevice
}
Else {
@Henry-E
Henry-E / closeAuxAccount.ts
Created April 25, 2024 09:46
Close aux token account
import * as anchor from "@coral-xyz/anchor";
import { PublicKey, Transaction, ComputeBudgetProgram } from "@solana/web3.js";
import * as token from "@solana/spl-token";
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
// Assumes your running with `anchor run closeAux --provider.cluster mainnet --provider.wallet ~/.config/solana/your-key.json`
const payer = provider.wallet["payer"];