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
-- rename Project Euler files in git lost-found directory | |
-- get the file type and the problem number from the initial comments | |
-- in each file | |
import System.Directory | |
import Text.Regex.Posix | |
import Control.Monad (forM_) | |
lostFilesDir = ".git/lost-found/other" |
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 perl | |
## look for files in case-insensitive manner | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use File::Glob ":glob"; | |
my $filename = shift or die "Missing filename"; |
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
;; set font interactively | |
;; from https://news.ycombinator.com/item?id=6773670 | |
(defun set-font (font-family height) | |
(interactive "sFont family: \nnHeight: ") | |
(set-face-attribute 'default nil :family font-family :height height) | |
(set-fontset-font "fontset-default" 'unicode font-family)) |
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 perl | |
use v5.14; | |
use mop; | |
use Data::Printer; | |
class Foo { | |
has $!foo is ro; | |
method new($class: $foo) { |
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 perl | |
use v5.14; | |
use mop; | |
class Foo { | |
has $!sentence is ro; | |
method new($class: @words) { | |
$class->next::method(words => \@words); |
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 perl | |
use Benchmark qw/:all :hireswallclock/; | |
use Math::BigFloat; | |
use Math::Pari; | |
my $count = shift || 10_000; | |
my $pressure_bf = Math::BigFloat->new(1011.4598); | |
my $pressure_pari = Math::Pari::PARI(1011.4598); |
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/perl | |
use feature qw{ say state }; | |
use strict; | |
use warnings; | |
use Benchmark qw{:all}; | |
use Carp; | |
my $str = "state declares a lexically scoped variable, just like my. However, those variables will never be reinitialized, contrary to lexical variables that are reinitialized each time their enclosing block is entered."; | |
my $len = length($str); |
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
#!perl | |
use strict; | |
use warnings; | |
use Test::More; | |
{ | |
package Foo; |
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
(defun copy-comment-paste () | |
"copy active region/current line, comment, and then paste" | |
(interactive) | |
(unless (use-region-p) | |
(progn | |
(beginning-of-line 2) | |
(push-mark (line-beginning-position 0)))) | |
(kill-ring-save (region-beginning) (region-end)) | |
(comment-region (region-beginning) (region-end)) | |
(yank) |
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
scala -classpath target/scala-2.10/classes:$HOME/.ivy2/cache/commons-cli/commons-cli/jars/commons-cli-1.2.jar:$HOME/.ivy2/cache/jline/jline/jars/jline-2.10.jar org.moe.Moe |