Skip to content

Instantly share code, notes, and snippets.

@totetmatt
totetmatt / yougif.sh
Created January 17, 2020 08:29
Grab a video and create a gif from selected timestamp
# $1 = Video URL
# $2 = Time to start (format 00:00:00)
# $3 = Duration of sample (format 00:00:00)
# $4 = Output file
youtube-dl -f mp4 \
$1 \
-o - \
| ffmpeg -i pipe: \
-ss $2 \
-t $3 \
@totetmatt
totetmatt / bsearchinsert.sh
Last active January 7, 2020 19:02
bsearchinsert.sh
#!/bin/bash
# set -x
KEY=$1
FILE=$2
# If file doesn't exists
if [ ! -f "$FILE" ]
then
touch $FILE
fi
https://www.youtube.com/playlist?list=PLhM2cOpnyjtYwbqD0LzpqFfIKMBLycsbe
https://www.youtube.com/playlist?list=PLQy7BP5B_ri-0fVxdD5Dj7Glm-PvsocjV
https://www.youtube.com/playlist?list=PLQy7BP5B_ri-s-crnEgeWUwOa7pJNf4tM
@totetmatt
totetmatt / ccc.cpp
Last active December 29, 2019 19:43
ccc.cpp
// g++ -o ccc ccc.cpp
// ./ccc 'a' 'aacb' && echo 'YES' || echo 'NO'
#include <iostream>
#define ENDSTRING '\0'
#define DOTCHAR '.'
#define STARCHAR '*'
int regex(char *str, char* pattern) {
// We are gonna use the C++ pointer arithmetic to go forward through our strings.
// #Pointer #PointerArithmetic
@totetmatt
totetmatt / ccc-2019.sh
Created December 19, 2019 09:27
ccc-2019.sh
#!/bin/bash
# Storing the input string
pattern=$1
string=$2
# We will use 2 pointers
ptrPattern=0
ptrString=0
@totetmatt
totetmatt / ccc-2019.hs
Last active December 19, 2019 07:40
ccc-2019.hs
-- Compilation : ghc ccc2019.hs -o regex
-- Usage : ./regex "a*b" "aaab"
import System.Environment
import System.Exit
main :: IO ()
eq a b | a == '.' = True
@totetmatt
totetmatt / ccc-2019.scala
Created December 18, 2019 15:36
Christmas Coding Challenge 2019 (Scala)
case class RegexOperator(c:Char,a:Option[Char]=None) {
def eqmatch(ch:Char): Boolean = ch == c || c == '.'
}
def parsePattern(p:String) =
p.foldLeft(Seq.empty[RegexOperator])( (agg,el)=> el match {
case '*' =>agg.init :+ agg.last.copy(a=Some('*'))
case c => agg :+ RegexOperator(c)
})
def regex(p:String,s:String): Boolean = {
Shirakawa
Chongqing Hongyadong
Zhangjiajie
District de Tai'erzhuang, Zaozhuang, Shandong, Chine
Xiaozhai Tiankeng (小寨天坑)
Huading National Forest Park
敦煌
长白山 天池
九寨沟
China, Island Hainan, city Sanya, Dadonghai beach
shanxi xiguan / School that suffle
37 - https://www.youtube.com/watch?v=QEbcShAoCss - https://www.imdb.com/title/tt0100758/
36 - https://www.youtube.com/watch?v=zJHWmSa6a30 - https://www.imdb.com/title/tt0275277/
35 - https://www.youtube.com/watch?v=ESKg7nbTmUI - https://www.imdb.com/title/tt0093777/
34 - https://www.youtube.com/watch?v=oigoehRD-VE - https://www.imdb.com/title/tt0065955/
33 - https://www.youtube.com/watch?v=mecSHTQw8x4 - https://www.imdb.com/title/tt0103874/
32 - https://www.youtube.com/watch?v=LmHLedAnkfY - https://www.imdb.com/title/tt0395584/
31 - https://www.youtube.com/watch?v=-DhX8gFGALc - https://www.imdb.com/title/tt0062711/
30 - https://www.youtube.com/watch?v=d71jVWrY4eI - https://www.imdb.com/title/tt0091605/
29 - https://www.youtube.com/watch?v=YRXdDq6h0hI - https://www.imdb.com/title/tt0119567/
28 - https://www.youtube.com/watch?v=Uy8tn_JltNs - https://www.imdb.com/title/tt0109592/