This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Compilation : ghc ccc2019.hs -o regex | |
-- Usage : ./regex "a*b" "aaab" | |
import System.Environment | |
import System.Exit | |
main :: IO () | |
eq a b | a == '.' = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Storing the input string | |
pattern=$1 | |
string=$2 | |
# We will use 2 pointers | |
ptrPattern=0 | |
ptrString=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set -x | |
KEY=$1 | |
FILE=$2 | |
# If file doesn't exists | |
if [ ! -f "$FILE" ] | |
then | |
touch $FILE | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 150 | |
in VertexData | |
{ | |
vec4 v_position; | |
vec3 v_normal; | |
vec2 v_texcoord; | |
} inData; | |
out vec4 fragColor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# crontab -l | |
59 09 * * 1-5 export DISPLAY=:0.0 && /usr/bin/play.sh | |
# ^---------- better to wrap the command to a script | |
# ^------make it launchable without display / terminal | |
# | |
# /usr/bin/play.sh | |
#!/bin/bash | |
/usr/bin/mplayer -vo null -vc dummy -really-quiet -volume 75 -loop 2 "$(ls /home/totetmatt/Music/JRMelody/* | shuf | head -n 1)" > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 150 | |
in VertexData | |
{ | |
vec4 v_position; | |
vec3 v_normal; | |
vec2 v_texcoord; | |
} inData; | |
out vec4 fragColor; |