Skip to content

Instantly share code, notes, and snippets.

@vedant
vedant / gem.sh
Created February 24, 2024 19:14
Gemini command-line utility
gem() { api_key="SOME_API_KEY"; if [ -p /dev/stdin ]; then p=$(cat); else p=""; fi; f="$1 $p"; j=$(jq -n --arg text "$f" '{contents: [ { parts: [ { text: $text } ] } ] }'); curl -s -H 'Content-Type: application/json' -d "$j" -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=$api_key" | jq -r '.candidates[0].content.parts[0].text'; }
@vedant
vedant / build.sh
Created October 29, 2016 23:46
Set up Ubuntu 14.04 to run Tensorflow
echo "hostname" > /etc/hostname
echo "127.0.0.1 davinci" >> /etc/hosts
sudo service hostname restart
export PS1="\[\e[01;31m\]\u\[\e[00m\]@\[\e[01;34m\]\h\[\e[00m\] [\A] [\[\e[01;32m\]\W\[\e[00m\]] :: "
# Set up NVIDIA Drivers
sudo add-apt-repository -y ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install -y dkms
sudo apt-get install -y linux-headers-generic
@vedant
vedant / gist:9333992
Last active May 27, 2020 06:46
Export note files from Google Keep
/* Vedant Misra (vedantmisra.com) (github.com/vedant)
*
* Script for exporting Google Keep note files.
*
* This does not handle attachments or checklists, only note files. Downloads
* each note to a .txt file named for the note's title.
*
* To use this, go to https://drive.google.com/keep/ and wait for the page to
* fully load all of your saved notes; scroll to the bottom to confirm they're
* loaded. Then paste the below in your URI bar, go to the start of the line,
@vedant
vedant / pytsa.py
Created October 3, 2011 20:34
Simple time series utility for pedagogical purposes
#!/usr/bin/env python
# -*- coding: ascii -*-
#-----------------------------------------------------------------------------
"""
Time Series Analysis
pytsa (read "pizza") depends on scipy and numpy.
Pytsa is a simple timeseries utility for python.
It is good for pedagogical purposes, such as to understand moving averages,
linear regression, interpolation, and single/double/triple exponential smoothing.