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
package main | |
// go play with my original code: https://go.dev/play/p/dt8WFHM1E8d | |
import ( | |
"fmt" | |
"regexp" | |
) | |
var validLPA = []string{ |
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
CREATE OR REPLACE FUNCTION public.prefixes(character varying) RETURNS character varying[] | |
LANGUAGE sql IMMUTABLE | |
AS $_$ | |
SELECT ARRAY(SELECT substring($1 FROM 1 FOR i) | |
FROM generate_series(1, GREATEST(length($1))) g(i))::varchar[]; | |
$_$ | |
SELECT MAX(prefix) FROM MY_TABLE WHERE prefix=ANY(content); |
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
<?php | |
$fd = inotify_init(); | |
$watch_descriptor = inotify_add_watch($fd, './watch', IN_CLOSE_WRITE); | |
while (true) { | |
$events = inotify_read($fd); | |
foreach ($events as $event) { |
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
<?php | |
while (!feof(STDIN)) { | |
$f = fgets(STDIN); | |
if ($f) { | |
echo ">> $f\n"; | |
} | |
} |
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
require 'thread' | |
queue = Queue.new | |
threads = [] | |
1.step(1000) do |i| | |
queue << i | |
end | |
8.times do |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
t, _ := time.Parse("2006-01-02 15:04", "2021-05-17 10:55") | |
today := t.Weekday() |
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
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"strings" | |
) | |
// GetMachineInfo return a list of: |
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
<?php | |
$doc = new DOMDocument(); | |
$doc->loadHTMLFile('test.html', LIBXML_NOWARNING | LIBXML_NOERROR); | |
$nodes = $doc->getElementsByTagName('head'); | |
if ($nodes->length <= 0) { | |
die('no head found'); | |
} |
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
#!/usr/bin/env python2 | |
def validate_id_number(id_num): | |
anID = id_num.zfill(9) | |
return sum( | |
sum( | |
map( | |
int, str(int(a)*(i % 2 + 1)) | |
) |
NewerOlder