Skip to content

Instantly share code, notes, and snippets.

@dajare
dajare / PHP Sort by Scripture (Bible)
Created March 15, 2018 21:26 — forked from oleosjo/PHP Sort by Scripture (Bible)
Comp function to sort PHP Array by Bible Verses (Scripture Books)
function scripturesort($a, $b) {
if ($a == $b) {return 0;}
$order=array("Genesis", "Exodus", "Leviticus", "Numbers", "Deuteronomy", "Joshua", "Judges", "Ruth", "1 Samuel", "2 Samuel", "1 Kings", "2 Kings", "1 Chronicles", "2 Chronicles", "Ezra", "Nehemiah", "Esther", "Job", "Psalm", "Proverbs", "Ecclesiastes", "Song of Solomon", "Isaiah", "Jeremiah", "Lamentations", "Ezekiel", "Daniel", "Hosea", "Joel", "Amos", "Obadiah", "Jonah", "Micah", "Nahum", "Habakkuk", "Zephaniah", "Haggai", "Zechariah", "Malachi", "Matthew", "Mark", "Luke", "John", "Acts", "Romans", "1 Corinthians", "2 Corinthians", "Galatians", "Ephesians", "Philippians", "Colossians", "1 Thessalonians", "2 Thessalonians", "1 Timothy", "2 Timothy", "Titus", "Philemon", "Hebrews", "James", "1 Peter", "2 Peter", "1 John", "2 John", "3 John", "Jude", "Revelation");
$fa = $a;
$fb = $b;
preg_match('/^..(.+?)\b/', $a, $matches);
$a = trim(substr($matches[0],0,4));
@dajare
dajare / time2base62.sh
Created January 30, 2018 11:06
Bash shell script to return last four characters of base62 conversion of unix timestamp
#!/bin/bash
# takes unix timestamp and converts to base62
# source: https://stackoverflow.com/a/14472352/232251
function u2b {
v=$(date +%s)
BASE62=($(echo {0..9} {a..z} {A..Z}))
for i in $(bc <<< "obase=62; $v"); do echo -n ${BASE62[$(( 10#$i ))]}
done
}
@dajare
dajare / time2base36.sh
Last active January 3, 2021 18:25
Shell script to convert unix timestamp to base36 (alphanumeric, lowercase)
#!/bin/bash
# takes unix timestamp and converts to base36
# ht: https://en.wikipedia.org/wiki/Base36#bash_implementation
value=$(date +%s)
result=""
base36="0123456789abcdefghijklmnopqrstuvwxyz"
while true; do
result=${base36:((value%36)):1}${result}
if [ $((value=${value}/36)) -eq 0 ]; then
@dajare
dajare / install-upgrade-skype-ubuntu.md
Created January 12, 2018 10:27
How to install Skype on Ubuntu 17.04+ using repo

Install / Upgrade Skype on Ubuntu 17.04 / 17.10

Original at: WebsiteForStudents.com

07/17/2017 | Applications, Linux Ubuntu | 12 Comments

Looking for help installing Skype? This brief tutorial is going to show students and new users how to install Skype for Linux on Ubuntu 17.04 / 17.10 desktop. Skype is a very popular free VOIP software used to make free Skype-to-Skype calls and text to stay in touch with friends and family.

A Linux version of Skype was recently updated.. and this adds some new features including, enhanced user interface, cloud-based group chat experience, PulseAudio support and file transfer improvements across multiple devices and bunch of other fixes.

@dajare
dajare / Add_Timeline_Button_to_Stack_Exchange_questions.user.js
Created August 17, 2017 13:42 — forked from BrockA/Add_Timeline_Button_to_Stack_Exchange_questions.user.js
Adds a link to the timeline view to questions. This is a userscript for Stack Exchange sites.
// ==UserScript==
// @name Stack Exchange: Add Timeline and Revisions links to posts
// @description Adds links to posts to always show history and links to questions to show the Timeline".
// @namespace StackExchange
// @match *://*.askubuntu.com/questions/*
// @match *://*.mathoverflow.net/questions/*
// @match *://*.serverfault.com/questions/*
// @match *://*.stackapps.com/questions/*
// @match *://*.stackexchange.com/questions/*
// @match *://*.stackoverflow.com/questions/*
@dajare
dajare / conv.sh
Created August 4, 2017 09:07
Bash script to convert directory of FLAC files to MP3 (set codec detail -- current 128)
#!/bin/bash
for i in *.flac ; do
ffmpeg -i "$i" -ab 128k -map_metadata 0 -id3v2_version 3 $(basename "${i/.flac}").mp3
sleep 60
done
@dajare
dajare / ccount.py
Last active June 21, 2017 14:01
Counts unicode range (total printable characters) in mixed text file; currently set to Hebrew
#!/usr/bin/python
# coding: utf-8
import re
import codecs
import sys
## chmod 0755 to make executable
## run with `./name.py input_file`
## source: https://unix.stackexchange.com/a/372270/99759
@dajare
dajare / py_errors.txt
Created June 20, 2017 19:23
python errors
> ./hcount.py
./hcount.py: line 2: import: command not found
./hcount.py: line 3: import: command not found
./hcount.py: line 8: syntax error near unexpected token `('
./hcount.py: line 8: `find_hebrew = re.compile(ur'[\u0590-\u05ff]+') # python 2'
@dajare
dajare / insert_Th_no_ligature.bas
Last active April 19, 2017 15:03
LibreOffice Writer Basic macro to insert string "Th" without ligature
Sub insert_Th_no_ligature
Dim oDoc as variant
oDoc = ThisComponent
Dim oCurrentController as variant
oCurrentController = oDoc.getCurrentController()
Dim oTextViewCursor as variant
oTextViewCursor = oCurrentController.getViewCursor()
Dim oText as variant
If IsEmpty(oTextViewCursor.Cell) Then
oText=oTextViewCursor.Text
@dajare
dajare / yal-edi-grp-2016.md
Last active January 13, 2016 13:30
Yale-Edinburgh Group, 2016 meeting

on the History of the Missionary Movement and World Christianity

Consultations sponsored by the Centre for the Study of World Christianity at the University of Edinburgh, Yale Divinity School, and the Overseas Ministries Study Center

Information re. June 23-25, 2016 meeting in Edinburgh