Skip to content

Instantly share code, notes, and snippets.

@rajatsharma
rajatsharma / bookmarks-to-notion.js
Created January 23, 2022 08:25 — forked from iamandrewluca/bookmarks-to-notion.js
Export browser bookmarks, import them in Notion as a database
(function bookmarksExportToCsv() {
/**
* 1. Export bookmarks from browser (supported any Chromium based browsers and Safari) (chrome://bookmarks)
* 2. Open exported html file again in the browser
* 3. Copy paste this entire file in console, and execute it (hit enter)
* 4. You will be prompted to save a CSV file. Save it.
* 5. Open Notion. Click Import -> CSV
* 6. Select saved CSV file. Wait for import
* 7. You have a new database with all your bookmarks
*/
@rajatsharma
rajatsharma / descartes.rs
Created December 18, 2021 19:03
Descartes
use clap::{app_from_crate, arg, App};
use common_rs::Result;
use std::fs;
use std::path::PathBuf;
use std::process::Command;
fn get_base_path() -> PathBuf {
let mut bookmark_path = PathBuf::new();
bookmark_path.push("~/.descartes");
bookmark_path.to_owned()

Keybase proof

I hereby claim:

  • I am rajatsharma on github.
  • I am rajatsharma (https://keybase.io/rajatsharma) on keybase.
  • I have a public key ASAkznrmaDyrzFJqebStGJy6TM52V8wPNe8UX1gQNSLZqAo

To claim this, I am signing this object:

@rajatsharma
rajatsharma / git-credential-wsl.sh
Last active April 18, 2021 13:28
To use Git for Windows credentials inside WSL
# Setup Git Credential Helper
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager.exe"
@rajatsharma
rajatsharma / android-sdk.sh
Created April 18, 2021 13:26
Install Android SDK on Linux based systems
# Install Android
nix-env -i unzip
cd ~
wget https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
unzip commandlinetools-linux-6609375_latest.zip -d Android
mkdir Android/cmdline-tools
mv Android/tools/ Android/cmdline-tools/
Android/cmdline-tools/tools/bin/sdkmanager --install "platform-tools" "platforms;android-28" "build-tools;28.0.3"
cd -
@rajatsharma
rajatsharma / config.nix
Created April 17, 2021 17:19
Install global node packages using nix
# Save it in .nixpkgs/config.nix
with import <nixpkgs> { }; {
packageOverrides = super: {
nix-npm-install = writeScriptBin "npmig" ''
#!/usr/bin/env bash
tempdir="/tmp/nix-npm-install/$1"
mkdir -p $tempdir
pushd $tempdir
# note the differences here:
case class Endorsement(person: String, skill: String)
val endorsements = List(
Endorsement("Bob", "JS"),
Endorsement("David", "JS"),
Endorsement("Bob", "HTML"),
Endorsement("James", "HTML"),
Endorsement("James", "JS"),
Endorsement("James", "CSS")
).foldLeft(List())((acc: List, x: Endorsement) => x.)
val m1 = Map[String, Int]("a" -> 1, "b" -> 3, "d" -> 4).toList
val m2 = Map[String, Int]("a" -> 7, "c" -> 3, "d" -> 1).toList
m1.zip(m2).map(x => (x._1._1, x._1._2 + x._2._2)) // List((a,8), (b,6), (d,5)): List[(String, Int)]
val nums: List[Int] = List(1, 2, 3, 4)
def repeat[A](n: Int, list: List[A]): List[A] = list.foldLeft(List[A]())((acc, x) => acc ++ List.fill(n)(x))
repeat(2, nums) // List(1, 1, 2, 2, 3, 3, 4, 4): List[Int]
@rajatsharma
rajatsharma / .init.el
Created October 18, 2020 09:27
Spacemacs Config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory