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
# Install PostGIS 3.1.5 for PostgreSQL 13.10 on Amazon Linux 2 | |
# ref: | |
# - https://ja.stackoverflow.com/questions/75401/amazon-linux2-%E3%81%B8-postgresql-postgis-%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%9F%E3%81%84 | |
# - https://qiita.com/tmiki/items/00d22edc6a554f61bd04 | |
sudo yum update -y | |
sudo amazon-linux-extras install epel | |
sudo yum install -y epel-release |
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 -e | |
[ $# -ne 1 ] && { echo "Usage: `basename $0` <filename>"; exit 1; } | |
F=$1 | |
IP=`ifconfig en0 | awk '/inet / {print $2}'` | |
PORT=8080 | |
ADDR="$IP:$PORT" | |
echo $ADDR | pbcopy | |
echo "serving $F at $ADDR (copied)" |
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 -e | |
[ $# -ne 1 ] && { echo "Usage: `basename $0` <filename>"; exit 1; } | |
F=$1 | |
echo -en '\xEF\xBB\xBF' | cat - "$F" |
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
// cc -Wall -lm dmod.c -o dmod && ./dmod | |
#include <stdio.h> | |
#include <math.h> | |
static inline double dmod(double n, double d) { return n - floor(n/d)*d; } | |
int main() { | |
double n = -0.1; | |
double d = 20.0; |
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
Lambda Calculus Examples | |
======================== | |
Alpha-Beta Conversion | |
--------------------- | |
(λu. (λx. x (λy. x y)) u ((λu. u)(λw. w))) (λz. (λv. z v y)) | |
-α-> (λu. (λx. x (λy. x y)) u ((λa. a)(λw. w))) (λz. (λv. z v y)) | |
-β-> (λx. x (λy. x y)) (λz. (λv. z v y)) ((λa. a)(λw. w)) | |
-β-> (λx. x (λy. x y)) (λz. (λv. z v y)) (λw. w) | |
-α-> (λx. x (λa. x a)) (λz. (λv. z v y)) (λw. w) |
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 bash | |
[ $# -ne 1 ] && { echo >&2 "Usage: `basename $0` audiobook.aax"; exit 1; } | |
type ffmpeg > /dev/null 2>&1 || { echo >&2 "Error: ffmpeg required"; exit 1; } | |
SRC="$1" | |
ACTIVATION_BYTES='' # can be obtained by audible-activator <https://github.com/inAudible-NG/audible-activator> | |
[ "$ACTIVATION_BYTES" = '' ] && read -p '4 byte activation secret (e.g. 1CEB00DA): ' ACTIVATION_BYTES | |
ffmpeg -activation_bytes "$ACTIVATION_BYTES" -i "$SRC" -vn -c:a copy "${SRC%.aax}.mp4" |
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
Unification Algorithm | |
===================== | |
Attempt 1 | |
--------- | |
Unify | |
{ (F('a,F('b,'b)) = F(P('c,L('c)), F(P('e,L('d)),P('c,'f)))) | |
, (P(P(N,'d),'c) = P('a,'c)) | |
} |
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 terminal svg | |
set output 'mult_tiled_1024.svg' | |
set grid | |
set title 'Tiled Matrix Multiplication (when N=1024): time vs. tile\_size' | |
set ylabel 'Time (sec)' | |
set xlabel 'tile\_size' | |
set yrange [9:15] | |
show label | |
plot './mult_tiled_1024.dat' with linespoints notitle, \ | |
'./mult_tiled_1024.dat' using 1:2:(sprintf("%d", $1)) with labels offset 1,1 notitle |
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
#define IND(row,col,n) ((row)*n+(col)) | |
void transpose_basic(double* A, double* B, int N) { | |
for (int i = 0; i < N; i++) { | |
for (int j = 0; j < N; j++) { | |
B[IND(i,j,N)] = A[IND(j,i,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
#!/usr/bin/env bash | |
NETADDR='192.168.1' | |
for ip in "$NETADDR".{1..254}; do | |
echo -n $ip | |
ping -c1 -W1 "$ip" > /dev/null 2>&1 && echo ' ok' || echo | |
sleep 0.25 | |
done |
NewerOlder