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 FUNCTION pseudorandom(seed DOUBLE PRECISION, n int) | |
RETURNS DOUBLE PRECISION AS $$ | |
-- Set the seed (optional). When recursing, this is obviously not done. | |
SELECT CASE WHEN seed IS NOT NULL THEN setseed(seed) END; | |
-- recurse until counter reaches 0 | |
SELECT CASE WHEN n>0 THEN pseudorandom(NULL, n-1) END; | |
-- run random() once. When counter reached 0, this will be the returned. |
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
-- i_am_spatial.raw_gpx_data's gpx_xml column contains GPX data stored as XML. | |
-- below query lists the trackpoints from this table, along with the file_id they belong to. | |
-- | |
-- PostGIS is necessary to have the geometry data type available. Otherwise, the outermost SELECT can be removed. | |
SELECT | |
file_id,SELECT | |
file_id, | |
point_time, | |
lat, |
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
Get-ChildItem | | |
Where-Object -Property "Name" -Like "*remove this part from the filename*" | # filtering | |
ForEach-Object { | |
# action to do. Case in point: rename the file. Note the parentheeses around the two parameters. | |
Move-Item ($_.Name) ([System.Text.RegularExpressions.Regex]::Replace($_.Name, "remove this part from the filename", "")) | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/sh | |
MAXLABELCOUNT=4 | |
MINCONFIDENCE=90 | |
mkdir smallpics | |
# create smaller versions, that are both small and big enough for image recognition | |
parallel convert {} -resize 2048x2048 -quality 90 smallpics/{} ::: *.jpg |
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
import time | |
def donothingDecorator(f): | |
""" Make a function returning some string return it prepended with the string's length. """ | |
def wrapper(*args, **kwargs): | |
#print("ogwell") | |
returnvalue = str(f(*args, **kwargs)) | |
return str(len(returnvalue)) + " " + returnvalue | |
return wrapper |
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 | |
# make a quick overview of the pictures in a folder | |
# I'm using this for Amazon S3, to have preview of the items I have in Deep Glacier | |
# create an empty folder: index/ | |
# make folder: index/thumbnails | |
# generate thumbnails for files | |
# generate index.html | |
# - generate metadata.js | |
# - add thumbnails | |
# - add metadata (todo) |
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
<Multi_key> <colon> <parenright> : "☺" # Compose : ) | |
<Multi_key> <minus> <less> : "←" U2190 # Compose - < | |
<Multi_key> <minus> <greater> : "→" U2192 # Compose -> | |
<Multi_key> <o> <o> : "…" U2026 # Compose | |
<Multi_key> <asterisk> <asterisk> : "★" | |
<Multi_key> <asciitilde> <asciitilde> : "≈" U2248 | |
<Multi_key> <s> <n> <o> : "☃" # Snowman! |
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 | |
/* Result of some quick night-coding, so don't expect much. | |
There should be a show.db sqlite3 database with a schema like | |
in line 22. | |
If there isn't a new one is created with helloworld as a default password. | |
New passwords can be created, they are stored as sha1() hashes. | |
One can create a new link on show.php?mode=admin; the file names are paths on the web server. | |
The links are going to look like this: show.php?session=SESSION |
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
(new MutationObserver(function (mutation) { // create a mutationobserver for checking any new nodes added to the chats | |
mutation.forEach(function (m) { // each mutation shall be iterated. | |
for (var node of m.addedNodes) { // each item may contain the added nodes | |
message = node.textContent; | |
if (( message.substr(0, 4) == 'jscr') && confirm("evaluate?")) { // if message matches some conditions | |
// do stuff with the message | |
console.log(message.substr(4, 40)); | |
} | |
} | |
}) |
NewerOlder