Skip to content

Instantly share code, notes, and snippets.

####All this because :

  • I need to have strong passwords everywhere
  • I don't want to use a single password everywhere
  • I can't remember all my passwords
  • I have productivity issues with LastPass & Keepass2

####Trade-Offs / Comparisons:

  • I happen to use my friends' computers heck lot, and using Lastpass/Keepass there is not always the best option
  • Lastpass seriously fucks up when you use two accounts in the same site, the integration there is more annoying than useful
  • I want to reproduce my password in every computer without downloading my full passwords file
@ayush--s
ayush--s / s3fs setup.sh
Last active June 2, 2020 22:04
S3FS setup with systemd
sudo apt install s3fs
echo "<redacted>" > ~/.passwd-s3fs
sudo nano /etc/systemd/system/s3fs.service
chmod 600 /home/ubuntu/.passwd-s3fs
sudo systemctl daemon-reload
sudo systemctl enable s3fs
@ayush--s
ayush--s / main.go
Last active June 2, 2020 22:05
Clickup commit msg hook
package main
// put this executable as .git/hooks/prepare-commit-msg
import (
"io/ioutil"
"log"
"os"
"strings"
)
@ayush--s
ayush--s / main.go
Created March 13, 2020 06:59
kill executables of a name over memory usage percentage
package main
import (
"fmt"
"log"
"log/syslog"
"strings"
"github.com/shirou/gopsutil/process"
)
import os
from datetime import date
import requests
from slugify import slugify
BASE = "https://www.bing.com"
URL = "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt={}"
MARKETS = {"en-US", "en-GB", "ja-JP"}
#!/bin/bash
intern=LVDS-1
extern=HDMI-1
if xrandr | grep "$extern disconnected"; then
xrandr --output "$extern" --off --output "$intern" --auto
else
xrandr --output "$intern" --off --output "$extern" --auto
fi
@ayush--s
ayush--s / Dockerfile
Created September 20, 2020 10:13
poetry
FROM ubuntu:focal
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3.8 wget python3-distutils python3-venv \
&& rm -fr /var/cache/apt/*
RUN wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
&& python3.8 get-pip.py \
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
#!/usr/bin/bash
# convert '*.png[800x>]' main.png
for i in *.png ; do
pngquant --quality 90 --speed 1 $i --output fin/final-$i --force
done
@ayush--s
ayush--s / chunk-details.sql
Created October 15, 2021 10:27
get chunk size + start, end for given table in timescaledb
WITH size AS (
SELECT
concat(chunk_schema, '.', chunk_name) AS name,
round(table_bytes / (1024 * 1024.0), 2) AS table_megs,
round(index_bytes / (1024 * 1024.0), 2) AS index_megs,
round(total_bytes / (1024 * 1024.0), 2) AS total_megs
FROM
chunks_detailed_size ('%%table%%')
ORDER BY
chunk_name,