This file contains hidden or 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
$pattern = "<html>`n" | |
ls *.wav | %{ | |
echo ("Fixing" + $_.FullName) | |
if ([System.Text.Encoding]::ASCII.GetString((gc $_.FullName -Encoding Byte -TotalCount ($pattern.Length * 2))).StartsWith($pattern)) { | |
echo ("Reading" + $_.FullName) | |
$stream = $_.OpenRead() | |
$stream.Seek($pattern.Length, [System.IO.SeekOrigin]::Begin) | |
$destStream = [System.IO.File]::OpenWrite($_.FullName + ".trimmed.wav") | |
echo ("Writing" + $_.FullName) | |
$stream.CopyTo($destStream) |
This file contains hidden or 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
ls . -Directory | % { $count = (ls $_ -Recurse).Count; $_ | Select *,@{Name="count"; Expression={$count} } } | Group-Object Count |
This file contains hidden or 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
# This is a thought exercise. | |
# Write down the output for the following two invocations | |
# - `> me false` | |
# - `> me true` | |
def me(ensure_fail = false) | |
begin | |
puts "inside" | |
fail "inside error" | |
rescue => error | |
puts "rescue" |
This file contains hidden or 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 | |
ANALYSIS_LENGTH=$(shuf -i 10-1000 -n 1) | |
echo -e "`date -u`: Analysis will take $ANALYSIS_LENGTH seconds" | |
sleep $ANALYSIS_LENGTH | |
echo "`date -u`: timeout completed" | |
ANALYSIS_SUCCESS=$[$RANDOM % 2] | |
echo -e "`date -u`: Analysis exit code: $ANALYSIS_SUCCESS" | |
exit $ANALYSIS_SUCCESS |
This file contains hidden or 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
/* | |
* This is a template for creating very complex PostgreSQL queries. | |
* Large queries quickly become very unreadable because variables and | |
* other snippets of code cannot be refactored out. This template demos | |
* using variables within an anonymous PL/pgSQL block and returning the | |
* table result, WITHOUT requiring write permission to the database! | |
* The use of variables are trivial within this example. | |
*/ | |
DO $$ |
This file contains hidden or 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
function Set-EnvironmentVariable($key, $value) { | |
Set-Content -Value $value -Path ("env:" + $key) | |
New-Variable -Scope Global -Name $key -Value $value -Force | |
} | |
function export($envVar) { | |
$split = $envVar.Trim().Split("="); | |
Set-EnvironmentVariable $split[0] $split[1] | |
} |
This file contains hidden or 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
"A distributed framework for managing and processing massive volumes | |
of diverse and complex datasets possibly generated at different rates | |
from different sources to solve complex problems an discover new knowledge | |
in a scalable, efficient, and reliable manner" - Jemal Abawajy, BDCloud2014, 05/12/14 |
This file contains hidden or 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
// -------------------------------------------------------------------------------------------------------------------- | |
// <copyright file="AutoAttachVs.cs" company="QutEcoacoustics"> | |
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | |
// </copyright> | |
// <summary> | |
// Example taken from this gist. | |
// </summary> | |
// -------------------------------------------------------------------------------------------------------------------- | |
#if DEBUG |
NewerOlder