Skip to content

Instantly share code, notes, and snippets.

@oylenshpeegul
oylenshpeegul / to_mp3.pl
Created Jun 10, 2021
Convert .opus and .m4a files to .mp3
View to_mp3.pl
#!/usr/bin/env perl
use v5.28;
use warnings;
use Path::Tiny;
use String::ShellQuote;
my $dir = path(shift // '..');
# Convert the .opus files by piping to opusdec first.
@oylenshpeegul
oylenshpeegul / shape3.pl
Last active Oct 18, 2022
The from-perl-to-rust Traits page using Object::Pad
View shape3.pl
#!/usr/bin/env perl
# Would it be worth replacing this Perl code?
# https://oylenshpeegul.gitlab.io/from-perl-to-rust/traits.html
use v5.32;
use Object::Pad;
role Area {
requires area;
View people.json
{"ANA":{"Adam Henrique":{"lastName":"Henrique","nationality":"CAN"},"Ben Hutton":{"lastName":"Hutton","nationality":"CAN"},"Cam Fowler":{"lastName":"Fowler","nationality":"USA"},"Carter Rowney":{"lastName":"Rowney","nationality":"CAN"},"Danton Heinen":{"lastName":"Heinen","nationality":"CAN"},"Derek Grant":{"lastName":"Grant","nationality":"CAN"},"Hampus Lindholm":{"lastName":"Lindholm","nationality":"SWE"},"Isac Lundestrom":{"lastName":"Lundestrom","nationality":"SWE"},"Jacob Larsson":{"lastName":"Larsson","nationality":"SWE"},"Jakob Silfverberg":{"lastName":"Silfverberg","nationality":"SWE"},"Jani Hakanpaa":{"lastName":"Hakanpaa","nationality":"FIN"},"John Gibson":{"lastName":"Gibson","nationality":"USA"},"Josh Mahura":{"lastName":"Mahura","nationality":"CAN"},"Josh Manson":{"lastName":"Manson","nationality":"CAN"},"Kevin Shattenkirk":{"lastName":"Shattenkirk","nationality":"USA"},"Max Comtois":{"lastName":"Comtois","nationality":"CAN"},"Max Jones":{"lastName":"Jones","nationality":"USA"},"Nicolas Deslaurie
View nhl-api.pl
#!/usr/bin/env perl
use v5.28;
use warnings;
use experimental qw(signatures);
use Data::Printer;
use Encode qw(encode);
use Getopt::Long::Descriptive;
use Interpolation E => 'eval';
use Mojo::JSON qw(decode_json encode_json);
@oylenshpeegul
oylenshpeegul / call_perl.el
Last active Aug 14, 2016
Emacs - insert the date with Perl
View call_perl.el
;; Use some Perl to insert the date.
(defun myday ()
"print the date"
(interactive)
(call-process "perl" nil t nil "-e" "
# perl code here
my @Monat = qw(Januar Februar Maerz April Mai Juni Juli August
September Oktober November Dezember);
my @Tag = qw(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag
@oylenshpeegul
oylenshpeegul / refcounts.pl
Created Jun 3, 2015
Compare Devel::Refcount::refcount with Internals::SvREFCNT
View refcounts.pl
#!/usr/bin/env perl
use v5.16;
use warnings;
use Devel::Refcount qw(refcount);
my $href = {};
say "BEGIN:" . refcount($href);
@oylenshpeegul
oylenshpeegul / diamond.go
Last active Aug 29, 2015
Emulate Perl's diamond operator in Go.
View diamond.go
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
@oylenshpeegul
oylenshpeegul / jsonlint.py
Created Mar 17, 2013
Check a JSON file against a Schema.
View jsonlint.py
#!/usr/bin/env python
import argparse
import json
import jsonschema
parser = argparse.ArgumentParser(
description='validate the json file against the json schema')
parser.add_argument(
'datafile', type=argparse.FileType('r'),
@oylenshpeegul
oylenshpeegul / tunesio.pl
Created Sep 16, 2012
Perl script to download a playlist from tunes.io
View tunesio.pl
#!/usr/bin/env perl
# Download all the files in a daily playlist from tunes.io
#
# https://gist.github.com/3734797
$ENV{MOJO_MAX_MESSAGE_SIZE} = 30_000_000;
use v5.16;
use warnings;
View local notes
$ notes init
Initializing notes (/home/tim/.notes)...
Initialized empty Git repository in /home/tim/.notes/.git/
$ notes add Hello World
Waiting for Emacs...
fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using
git remote add <name> <url>