Skip to content

Instantly share code, notes, and snippets.

View s0ubhik's full-sized avatar
📕
Studying

Soubhik Biswas s0ubhik

📕
Studying
View GitHub Profile
@s0ubhik
s0ubhik / fastgpt.sh
Created December 7, 2023 03:26
Fast GPT setup script
#!/bin/bash
ncol="\033[0m"
bold="\033[1m"
dim="\033[2m"
uline="\033[4m"
reverse="\033[7m"
red="\033[31m"
green="\033[32m"
yellow="\033[33m"
blue="\033[34m"
@s0ubhik
s0ubhik / bash_5.16_cd_three_dot.patch
Created May 17, 2023 06:36
Patch for cd ... support in bash
+++ builtins/cd.def 2023-05-17 11:57:46.148180535 +0530
@@ -328,6 +328,8 @@
return (EXECUTION_FAILURE);
}
lflag = 0;
+ } else if (strcmp(list->word->word, "...") == 0){
+ dirname = "../../";
}
#if defined (CD_COMPLAINS)
else if (list->next)
@s0ubhik
s0ubhik / check_perms.java
Created May 14, 2023 01:51
Request multiple permissions android java
String[] perms = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
public void check_perms(){
for (String perm: perms) {
if (ContextCompat.checkSelfPermission(this, perm) != PackageManager.PERMISSION_GRANTED) {
// request permission
@s0ubhik
s0ubhik / IntegerToBinary.py
Created June 30, 2021 09:55
Python function to convert integer to Binary String
def IntToBin(num):
bin_str = ""
while num > 0:
if num % 2 == 0: # num is even
bin_str = "0" + bin_str
else: # num is odd
bin_str = "1" + bin_str
num -= 1
num = num / 2
return bin_str
@s0ubhik
s0ubhik / jumble_word.py
Last active March 27, 2021 04:14
Jumble Word
import random
def jumble(words):
if not words: return
ret = []
le = len(words)
for _ in range(le):
r = random.randint(0,le-1)
while words[r] in ret:
r = random.randint(0,le-1)
ret.append(words[r])