Skip to content

Instantly share code, notes, and snippets.

@gugod
gugod / Nay.pm
Created September 22, 2023 04:48
Nay -- an object of negative identity.
package Nay;
use v5.36;
no warnings 'experimental::builtin';
use builtin 'false';
use overload 'bool' => sub { false };
use Exporter 'import';
our @EXPORT = qw(Nay);
my $Nay = bless {}, 'Nay';
use v5.36;
use Data::Dumper 'Dumper';
use PerlX::SafeNav ('$safenav', '$unsafenav');
package O {
sub bar { "bar" }
sub foo { undef }
};
sub safenav :prototype(&) ($cb) {
use v5.36;
use JSON ();
use Data::Dumper qw(Dumper);
package DieMan {
sub new ($class, $res = [], $err = undef) {
bless { "res" => $res, "err" => $err }
}
sub res ($self) { $self->{"res"} }
sub err ($self) { $self->{"err"} }
~/src/alpaca.cpp
# ./chat
main: seed = 1679633200
llama_model_load: loading model from 'ggml-alpaca-7b-q4.bin' - please wait ...
llama_model_load: ggml ctx size = 6065.34 MB
llama_model_load: memory_size = 2048.00 MB, n_mem = 65536
llama_model_load: loading model part 1/1 from 'ggml-alpaca-7b-q4.bin'
llama_model_load: .................................... done
llama_model_load: model size = 4017.27 MB / num tensors = 291
# Original version: https://github.com/gugod/App-perlbrew/blob/915e60b80d669c46aa77b78ccf01c3d37a3ec41d/lib/App/perlbrew.pm#L604
sub comparable_perl_version {
my ($self, $pv) = @_;
my ($mc, $mi, $mp) = $pv =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+)|^(?:(c?perl)-?)?-?blead$/
? ($1 && $1 eq 'cperl' ? -1 : 1) * sprintf('%02d%02d%02d%s', $2 + ($1 && $1 eq 'cperl' ? 6 : 0), $3, $4, $5 || '')
: (0,0,0);
return $mc . $mi . $mp;
}
#!/usr/bin/env raku
sub postfix:<!>( Int $n ) { [*] (1..$n) }
sub prefix:<Σ>( *@nums ) { [+] @nums }
sub compute_this (Int $n) {
Σ (0..$n).map(
-> $r {
$n! / ($r! * ($n - $r)!)
}
@gugod
gugod / try.sh
Created September 4, 2020 07:33
#!/bin/bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew list
perlbrew use perl-5.18.2
which perl
perl -V
/[厂几儿亏与万亿个勺么广门义尸卫飞习马乡丰开无专扎艺厅区历车冈贝见气长仆币仅从仓风匀乌凤为忆订计认队办劝书击扑节术厉龙灭轧东业旧帅归叶电号叹们仪丛乐处鸟务饥闪兰汇头汉宁讨写让礼训议讯记辽边发圣对纠丝动执巩扩扫扬场亚朴机权过协压厌页夺达夹轨迈毕贞师尘当吓虫团吗屿岁岂刚则网迁乔伟传优伤价华伪会杀众爷伞创肌杂负壮冲庄庆刘齐产决闭问闯并关汤兴讲军许论农讽设访寻迅尽导异孙阵阳阶阴妇妈戏观欢买红纤级约纪驰寿麦进远违运抚坛坏扰坝贡抢坟坊护壳块声报苍严芦劳苏极杨两丽医辰励还歼来连坚时吴县园旷围吨邮员听呜岗帐财针钉乱体伶彻余邻肠龟犹条饭饮冻状亩况库疗应这弃冶闲间闷灶灿沃沟怀忧穷灾证启评补识诉诊词译灵层迟张际陆陈劲鸡驱纯纱纳纲驳纵纷纸纹纺驴纽环责现规拢拣担顶拥势拦拨择苹茎柜枪构杰丧画枣卖矿码厕奋态欧垄轰顷转斩轮软齿虏肾贤国畅鸣咏罗帜岭凯败贩购图钓侦侧凭侨货质径贪贫肤肿胀胁鱼备饰饱饲变庙剂废净闸闹郑单炉浅泪泻泼泽怜学宝审帘实试诗诚衬视话诞询该详肃录隶届陕限驾参艰线练组细驶织终驻驼绍经贯帮挂项挠赵挡垫挤挥荐带茧荡荣药标栋栏树咸砖砌牵残轻鸦战点临览竖削尝显哑贵虾蚁蚂虽骂哗响峡罚贱钞钟钢钥钩选适种复俩贷顺俭须剑胆胜脉狭狮独狱贸饶蚀饺饼弯将奖疮疯亲闻阀阁养类逆总炼烂洁洒浇浊测济浑浓恼举觉宪窃语袄误诱说诵垦昼险娇贺垒绑绒结绕骄绘给络骆绝绞统艳蚕顽捞载赶盐损捡换热恐壶莲获恶档桥础顾轿较顿毙虑监紧党晒晓晕唤罢圆贼贿钱钳钻铁铃铅牺敌积称笔笋债倾舰舱爱颂胳脏胶脑皱饿恋桨浆离资阅烦烧烛递涛涝润涨烫涌宽宾请诸读袜课谁调谅谈谊剥恳剧难预绢验继掠职萝营梦检聋袭辅辆虚悬崭铜铲银笼偿衔盘鸽领脸猎馅馆痒盖断兽渐渔渗惭惊惨惯窑谋谎祸谜弹隐婶颈绩绪续骑绳维绵绸绿趋搁搂搅联确暂辈辉赏喷践遗赌赔铸铺链销锁锄锅锈锋锐筐筑筛储惩释腊鲁馋蛮阔粪湿湾愤窜窝裤谢谣谦属屡缎缓编骗缘摄摆摊鹊蓝献楼赖雾输龄鉴错锡锣锤锦键锯矮辞筹签简腾触酱粮数满滤滥滚滨滩誉谨缝缠墙愿颗蜡蝇赚锹锻稳箩馒赛谱骡缩嘱镇颜额聪樱飘瞒题颠赠镜赞篮辩懒缴辫骤镰仑讥邓卢叽尔冯迂吁吆伦凫妆汛讳讶讹讼诀驮驯纫玛韧抠抡坞拟芜苇杈轩卤呕呛岖佃狈鸠庐闰兑沥沦汹沧沪诅诈坠纬坯枢枫矾殴昙咙账贬贮侠侥刽觅庞疟泞宠诡屉弥叁绅驹绊绎贰挟荚荞荠荤荧栈砚鸥轴勋哟钙钝钠钦钧钮氢胧饵峦飒闺闽娄烁炫洼诫诬诲逊陨骇挚捣聂荸莱莹莺栖桦桩贾砾唠鸯赃钾铆秫赁耸颁脐脓鸵鸳馁斋涡涣涤涧涩悯窍诺诽谆骏琐麸掷掸掺萤萧萨酝硕颅晤啰啸逻铐铛铝铡铣铭矫秸秽躯敛阎阐焕鸿渊
function e {
local file="$1"
if [[ ! -f $file ]]; then
if [[ ${file[0,2]} == "a/" || ${file[0,2]} == "b/" ]]; then
file=${file[3,$#file]}
fi
fi
if [[ ! -f $file ]]; then
@gugod
gugod / .emacs
Created February 16, 2020 23:52
(let ((gc-cons-threshold most-positive-fixnum))
(progn
(package-initialize)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
;;; my setup
(add-to-list 'load-path "~/.__._./emacs/")
(require 'my-init)
))