Skip to content

Instantly share code, notes, and snippets.

@bathtime
bathtime / latin.sh
Last active February 26, 2018 23:32
Lewis and Short Elementary Latin Dictionary
#!/bin/bash
# This program requires an xml dictionary file to run. If it is not on your machine,
# it will automatically be downloaded and stored in ~/.config/latin/.
# Name this file as 'latin' and run:
#
# $ chmod +x latin
#
# To run:
@bathtime
bathtime / Latin Dictionary
Last active November 13, 2019 23:35
An offline console Latin Dictionary.
// This program reads an XML dictionary file and prints a formatted result in
// terminal.
//
// NOTE: The required XML dictionary (76mb) will be downloaded to this
// machine if it is not found!
//
//
// *******************************************
// * *
// * A VERY SPECIAL THANK YOU ! *
// This program parses an online XML dictionary site and prints
// conjugated results for input terms.
//
// The goals of this project:
//
// 1. < 100 lines code
// 2. Simple & elegant coding
// 3. Fast & efficient execution.
//
// "Do one thing,
// This program moniters the clipboard / primary (mouse selection) buffers
// and prints text or runs a command on change.
//
// The goals of this project:
//
// 1. < 100 lines code
// 2. Simple & elegant coding
// 3. Fast & efficient execution.
//
// "Do one thing,
// This program checks and/or monitors your emails,
// prints a count of new mail, and runs user a defined
// command upon a new email.
//
// Note: A file containing only the users last email
// count will be stored your computer in:
//
// ~/.config/mailcount
//
// The goals of this project:
@bathtime
bathtime / menu
Last active March 14, 2018 14:10
menu for dmenu
// This program gathers and pipes a user-created menu into
// dmenu and allows the user to pick and execute apps:
//
// dmenurc file -> menu -> dmenu -> run chosen app :)
//
// NOTE: dmenu MUST be installed for this program to work!
//
// The goals of this project:
//
// 1. < 100 lines code
@bathtime
bathtime / searchreplace.cpp
Created March 14, 2018 14:12
A search and replace function for use with other C++ programs.
//
// Compile with:
// $ g++ -O3 -Wall searchreplace.cpp -o searchreplace
//
// Run with:
// $ searchAndReplace
//
//
// This program searches for user specified text strings (a starting point
// point to an ending point) and replaces them and all contents between
@bathtime
bathtime / BTree
Last active March 30, 2018 16:43
// This code comes from:
// https://www.geeksforgeeks.org/b-tree-set-1-insert-2/
//
// It has been altered to support a string index and two integer values.
//
#include<iostream>
#include<string>
using namespace std;
@bathtime
bathtime / bar.cpp
Last active April 2, 2018 16:36
Bar
// Compile with:
//
// g++ -std=c++11 -O2 -Wall bar.cpp -o bar -lasound -lpthread
//
#include<alsa/asoundlib.h> // install libasound2-dev
#include<fstream>
#include<iostream>
#include<string>
#include<chrono>
@bathtime
bathtime / Canada.sh
Created April 2, 2018 15:00
Weather
#!/bin/sh
URL="https://weather.gc.ca/city/pages/on-77_metric_e.html"
A='center">'
B='</p>'
C='>'
D='&deg'
echo $(wget -q -O- "$URL" | awk -v v1="$A" -v v2="$B" -v v3="$C" -v v4="$D" '$0 ~ v1 ".*" v2 {sub(v2 ".*", ""); sub(".*" v1, ""); print $0; next;} $0 ~ v3 ".*" v4 {sub(v4 ".*", ""); sub(".*" v3, ""); print $0 "°C"; exit}')