Skip to content

Instantly share code, notes, and snippets.

View PradyumnaKrishna's full-sized avatar
👀
Watching

Pradyumna Krishna PradyumnaKrishna

👀
Watching
View GitHub Profile
@PradyumnaKrishna
PradyumnaKrishna / gtasa_save_edit.py
Last active August 30, 2023 10:33
GTA San Andreas Save File Edit using python
import struct
# Loads the save file having name `gtasasf1.b`.
with open("gtasasf1.b", "rb") as f:
data = bytearray(f.read())
# Generate blocks for the save file.
blocks = []
for i in range(len(data)-4):
@PradyumnaKrishna
PradyumnaKrishna / bisection
Created May 4, 2022 17:05
Numerical Method
bisection[f_, l_ : 0, u_ : 1, iters_ : 10] := (
a = l;
b = u;
If[f[a]*f[b] > 0,
Print["We cannot find the roots in the given interval"],
c = N[(a + b) / 2];
OutputDetails = {{0, a, b, c, f[c]}};
Do[
/*
* CRC
* Created on: 01-Oct-2014
* Author: Gourav Siddhad
*/
#include <cstring>
#include <iostream>
#define MAX 20
using namespace std;
@PradyumnaKrishna
PradyumnaKrishna / crypto.js
Last active March 28, 2023 20:48
RSA Encryption/Decryption in Python and Nodejs
const crypto = require('crypto');
var { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
format: 'pem'
}
});
@PradyumnaKrishna
PradyumnaKrishna / TypeWriter.applescript
Last active January 9, 2021 15:03
TypeWriter Effect to Write with AppleScript
# path to file for to read
set fc to read POSIX file "/Users/phoenix/Github/devops/app.py" as «class utf8»
global chars1
set prev_char to "a"
set chars1 to {" ", "\"", "(", ",", "\\", "=", "_", "@", ")", ".", ":"}
set the text item delimiters to (ASCII character 10)
set mylines to text items in fc
@PradyumnaKrishna
PradyumnaKrishna / install.sh
Last active November 9, 2024 05:14
Make any Instance Ready for Remote Desktop or RDP (Chrome Remote Desktop)
#!/bin/bash -x
#
# Startup script to install Chrome remote desktop and a desktop environment.
#
# See environmental variables at then end of the script for configuration
#
# Run this script by root
# a user will get created with name: user and password: root
@PradyumnaKrishna
PradyumnaKrishna / Commit Date.md
Last active November 5, 2024 23:52
Change Git Commit Date

Change Git Commit Date

  • Commit your git using

    git add -A
    git commit -m "commit message"
    
  • Change time or date of your latest commit

GIT_COMMITTER_DATE="Wed Sep 9 22:00 2020 +0530" git commit --amend --date="Wed Sep 9 22:00 2020 +0530"

@PradyumnaKrishna
PradyumnaKrishna / ZSH Prompt.md
Last active September 26, 2020 14:11
Custom ZSH Prompt for Terminal

Custom ZSH Prompt for Terminal in mac or linux

Setup custom prompt

  • Open .zshrc using you favoriate editor present at your home directory

  • Add these two lines

    PROMPT="%B%F{red}%n%f %F{cyan}%1~%f %(!.#.>) %b";
    export PROMPT