Skip to content

Instantly share code, notes, and snippets.

View devm33's full-sized avatar
:copilot:

Devraj Mehta devm33

:copilot:
View GitHub Profile
@devm33
devm33 / gitpush.conf
Last active October 11, 2017 00:04
Monitor directory for deletion and then push.
[program:gitpush]
command=/home/devm33/gitpush.sh
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/log/gitpush.err.log
stdout_logfile=/var/log/gitpush.out.log
user=devm33
@devm33
devm33 / onename_verification.txt
Created October 10, 2017 21:21
onename verification
Verifying that "devm33.id" is my Blockstack ID. https://onename.com/devm33
@devm33
devm33 / numbers.js
Last active August 8, 2024 15:14
English Numbers
// Convert numbers to english words
const digit = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
const teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen'];
const tens = [null, null, 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
const orders = ['hundred', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion'];
function floor(number, order) {
return Math.floor(number / order)
}
@devm33
devm33 / changedates.sh
Created June 19, 2018 04:27
Change the accessed / modified (and created on mac if older) of a bunch of photos to sort by date
#!/bin/bash
for f in *.jpg
do
num=${f//[^0-9]/}
secs=${num:0:4}
mmss=$(printf '%02d%02d\n' $((10#$secs/60)) $((10#$secs%60)))
touch -mt 20180528${mmss} $f
touch -t 20180528${mmss} $f
done
@devm33
devm33 / sync.sh
Created December 3, 2018 01:21
A Determined Rsync
#!/bin/bash
host='remote'
path='/remote/path/to/dir'
while ! rsync --append-verify -Prz $host:$path .
do
sleep 1
done
@devm33
devm33 / merge.go
Created July 3, 2019 20:06
Merge-sort in go
package main
import "fmt"
func main() {
a := createListNodes([]int{2, 3, 4, 0, 2, 8, 9})
fmt.Println("starting with", a)
fmt.Println("ending with", sortList(a))
}
@devm33
devm33 / heap.go
Created July 15, 2019 16:52
K Closest Points to Origin
package main
import (
"fmt"
"strings"
)
func main() {
p := [][]int{
[]int{17, -45},
@devm33
devm33 / board.go
Created August 1, 2019 15:13
solving a boggle problem in go
package main
import "fmt"
func main() {
var board = [][]byte{
[]byte{'A', 'B', 'C', 'E'},
[]byte{'S', 'F', 'C', 'S'},
[]byte{'A', 'D', 'E', 'E'},
}
package main
import "fmt"
func main() {
a := []int{1, 2, 3, 3, 2, 4, 2}
fmt.Printf("Local max of %v are %v\n", a, localMax(a))
}
func localMax(a []int) []int {
@devm33
devm33 / exclusive.go
Created August 7, 2019 15:12
find items exclusive to two lists
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {