Skip to content

Instantly share code, notes, and snippets.

@vedantroy
vedantroy / client.cpp
Last active April 8, 2024 22:26
A C++ Client That Sends Data Over TLS Using OpenSSL
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <resolv.h>
#include <netdb.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
//Not sure what headers are needed or not
//This code (theoretically) writes "Hello World, 123" to a socket over a secure TLS connection
@vedantroy
vedantroy / .vimrc
Last active July 18, 2020 01:32
My .vimrc
" Don't try to be vi compatible
set nocompatible
" System specific configuration
let uname = substitute(system('uname'),'\n','','')
if uname == 'Linux'
" Install Vim Plug, if it is not already installed
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@vedantroy
vedantroy / TicToc Optimizations.md
Last active July 12, 2019 02:50
Optimizations for TicToc (Non-Distributed) and Sundial (Distributed)

After reading a value, Q, a transaction, T, only needs to know the first change to Q's wts to determine how reading Q affects the upper-bound of T's commit time.

T can get notified when the wts of a value it reads changes by adds its id to a list of ids attached to Q. When T2 commits and overwrites Q, it will use the list of ids to send a message to each transaction that read from Q. The message will contain the new wts of Q. After sending all the messages, T2 will clear the list of ids attached to Q.

The list of ids is called tags.

def read(T, key):
    if key in T.WS:
        return WS[key].data
@vedantroy
vedantroy / Setup_Windows.ps1
Last active July 5, 2019 04:14
A script for setting up a basic windows environment. Utterly useless and made for amusement only.
Write-Host @"
This script installs the following programs:
- Scoop (Package manager for Windows)
- Scoop "extras bucket"
- 7zip (auto-installed by scoop)
- Git
- flux
- mpv
- qbittorrent
- vscode
sudo apt install locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libappindicator1 lsb-release xdg-utils
@vedantroy
vedantroy / settings.json
Created February 7, 2020 05:45
vscode config
{
// Use Visual Studio 2019 Developer Tools Terminal
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/k", "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\Tools\\VsDevCmd.bat"],
//"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
// VS Code Vim Settings
"vim.highlightedyank.enable": true,
// Enabling vim.ignorecase also enables smartcase
"vim.ignorecase": true,
"javascript.updateImportsOnFileMove.enabled": "always",
@vedantroy
vedantroy / add_text_to_wallpaper.py
Created December 14, 2020 08:20
Add text to my desktop wallpaper
#! /usr/bin/env python3
import sys
import os
import shutil
import subprocess
if __name__ == "__main__":
args = sys.argv
if len(args) < 3:
print(f"Usage: set.py [image name] [text]")
@vedantroy
vedantroy / rename_seq.py
Created December 24, 2020 00:38
Rename the files in a directory as 0, 1, 2,... in sorted order
#! /usr/bin/env python3
import os
import sys
if len(sys.argv) < 2:
print("Usage [exe name] [dir name]")
exit(1)
dir = sys.argv[1]
#! /usr/bin/env python3
import os
from subprocess import Popen, PIPE, STDOUT
def log(s):
home_dir = os.path.expanduser("~")
#with open (f"{home_dir}/monitor_script.log", "a+") as f:
with open (f"/home/vedantroy/monitor_script.log", "a+") as f:
f.write(s)
xrandr = "/usr/bin/xrandr"
@vedantroy
vedantroy / picom.conf
Created April 12, 2021 03:19
JDormit's picom config (git.jeremydormitzer.com)
# Thank you code_nomad: http://9m.no/ꪯ鵞
# and Arch Wiki contributors: https://wiki.archlinux.org/index.php/Compton
#################################
#
# Backend
#
#################################
# Backend to use: "xrender" or "glx".