Skip to content

Instantly share code, notes, and snippets.

View theSoberSobber's full-sized avatar
🐢

theSoberSobber

🐢
View GitHub Profile
@theSoberSobber
theSoberSobber / step.sh
Last active December 3, 2022 13:17
to step through a gh repo and study it's evolution
# include in sys varaibles to use everywhere
#!/bin/bash
echo "Enter branch name : "
read bname
chlist=$(git rev-list $bname --reverse)
tcnt=$(git rev-list $bname --count)
declare -i cnt=0
for ch in $chlist
do
# temp=$(git stash) # remove the comment hash only when you want to stash any changes you make along the way
@theSoberSobber
theSoberSobber / build.sh
Last active December 29, 2022 06:17
builds a list of currently working http proxies from https://github.com/TheSpeedX/PROXY-List
#!/bin/bash
curl https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt -o init.txt
while read -r p_url
do
echo $p_url
curl -x $p_url "https://checkip.amazonaws.com/"
done < "$(pwd)/init.txt"
rm -r init.txt
@theSoberSobber
theSoberSobber / cp.json
Created January 30, 2023 14:32
some snippets for competetive programming
{
"bp": {
"prefix": "bp",
"body": [
"#include <bits/stdc++.h>",
"using namespace std;\n",
"#define ll long long int",
"#define loop(i,a,b) for(int i=a;i<b;i++)\n",
@theSoberSobber
theSoberSobber / debug.h
Created January 31, 2023 18:32
my debugger
#include <bits/stdc++.h>
using namespace std;
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
void __print(int32_t x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(int64_t x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
{
"bp": {
"prefix": "bp",
"body": [
"#include <bits/stdc++.h>",
"#ifndef ONLINE_JUDGE",
"#include \"debug.h\"",
"#else",
"#define dbg(x...)",
"#endif",
-> boot into the disk installation through grub
-> systemctl start NetworkManager.service
-> nmcli device wifi list
-> nmcli device wifi connect <SSID> password <password>
-> sudo pacman -Syuu
-> sudo pacman -S base-devel
-> sudo pacman -S xorg xorg-xrandr xorg-server xorg-xinit picom rofi firefox kitty lightdm lightdm-gtk-greeter awesome git pulseaudio alsa alsa-utils thunar code
-> sudo pacman -S nvidia nvidia-utils nvidia-settings xorg-server-devel opencl-nvidia mesa mesa-demos xf86-video-amdgpu
import socks
import socket
import requests
import os
import time
import json
import urllib2
socks.setdefaultproxy(proxy_type=socks.PROXY_TYPE_SOCKS5, addr="127.0.0.1", port=9050)
struct IOPre {
static constexpr int TEN = 10, SZ = TEN * TEN * TEN * TEN;
std::array<char, 4 * SZ> num;
constexpr IOPre() : num{} {
for (int i = 0; i < SZ; i++) {
int n = i;
for (int j = 3; j >= 0; j--) {
num[i * 4 + j] = static_cast<char>(n % TEN + '0');
n /= TEN;
}
@theSoberSobber
theSoberSobber / rr sir ke madhur gaane.py
Created March 22, 2023 06:13
python scrape.py > out
import sys, json;
import urllib.request
import bs4 as bs;
ap=json.load(urllib.request.urlopen("https://codeforces.com/api/user.status?handle=18o3"))["result"];
for i in ap:
phtml = bs.BeautifulSoup(urllib.request.urlopen( f'https://codeforces.com/contest/{i["contestId"]}/submission/{i["id"]}'), "html.parser");
try:
out="";
code = phtml.body.find('pre', attrs={'id':'program-source-text'}).text;
for lno in range(len(code.splitlines())-7, len(code.splitlines())):
@theSoberSobber
theSoberSobber / server.json
Last active November 19, 2024 07:52
current ip of my home server, with a max lag of 60 seconds
{"ip": "116.72.194.187"}