Skip to content

Instantly share code, notes, and snippets.

@Dubhead
Dubhead / main.zig
Created November 29, 2021 10:21
Hello world with Zig and notcurses
// Hello world with Zig and notcurses
//
// Fedora 35 Worstation
// Zig 0.9.0-dev.1798+0f63f3eeb
// notcurses 2.4.9
// (1) Install notcurses dev library.
//
// $ sudo dnf install notcurses-devel
//
@Dubhead
Dubhead / kit.vim
Created October 29, 2018 22:38
kit.vim - Vim syntax file for Kit programming language
" Vim syntax file
"
" Language: Kit
" Maintainer: MIURA Masahiro <[email protected]>
" Last Change: 2018-10-30
" License: GNU Lesser General Public License, version 3
if exists("b:current_syntax")
finish
@Dubhead
Dubhead / gist:84a1d9a6fcef57d8448265f8f90880b9
Created October 24, 2018 18:14
term-rewriting rule in Kit
% cat src/test.kit
rules AddOne {
(ADD_ONE(${x: Int})) => x + 1;
}
using rules AddOne;
function main() {
var foo = ADD_ONE(42_i);
}
%
#!/bin/sh
#!/bin/zsh -x
# flac_renamer.sh - Renames FLAC files by tracknumbers.
#
# usage:
# $ ./flac_renamer.sh *.flac
# : e.g. MyArtist-MyTitle.flac is renamed to 01.flac
FLAC_FILES="$@"
@Dubhead
Dubhead / gist:a51904c9e55908c747d0
Last active August 29, 2015 14:21
「ソフトウェアエンジニアならば1時間以内に解けなければいけない5つの問題」の5問目を Pure で解いてみた
数式の文字列を eval できる言語ならどれでも大差なく解けそうなもの。
というわけで Pure (http://purelang.bitbucket.org/) で解いてみた。
#!/usr/bin/pure
using system; // for 'puts'
add100 acc 9
= puts acc if eval acc == 100;
= _ otherwise;
@Dubhead
Dubhead / gist:d8cfa77cad28394d318c
Created December 3, 2014 08:50
cannot build Falcon new_engine
on Fedora 20 x86_64, after setting all FALCON_BUILD_* to OFF in ccmake
% git log -1 HEAD | cat
commit 5c5ca3d39db30c22a4218bea40a45d2f94465f2d
Author: Giancarlo Niccolai <[email protected]>
Date: Wed Dec 3 00:05:30 2014 +0100
Fixed compilation on FreeBSD 10.1 64Bit - Clang
%
% ninja-build -k 1000
// simple HTTP client, based on
// https://mail.mozilla.org/pipermail/rust-dev/2013-August/005117.html
//
// Note: Envvar RUST_NEWRT=1 is required to compile and run this.
use std::rt::io::net::ip::{Ipv4Addr, SocketAddr};
use std::rt::io::net::tcp::TcpStream;
use std::rt::io::{Reader, Writer};
use std::str;
@Dubhead
Dubhead / gc.py
Created May 23, 2013 07:19
A Python version gets a lot slower when str.count(I) is inhibited.
#!/usr/bin/python
def main():
gcCount = 0
atCount = 0
with open("Homo_sapiens.GRCh37.67.dna_rm.chromosome.Y.fa", "r") as f:
for line in f:
if not line.startswith('>'):
# gcCount += line.count('G') + line.count('C')
# atCount += line.count('A') + line.count('T')
@Dubhead
Dubhead / gc.dart
Created May 23, 2013 07:08
calculating GC content in Dart
#!/usr/local/dart/dart-sdk/bin/dart
// gc.dart
// cf. http://saml.rilspace.org/moar-languagez-gc-content-in-python-d-fpc-c-and-c
import 'dart:io';
import 'dart:async';
main()
{
@Dubhead
Dubhead / gist:5574285
Created May 14, 2013 07:30
Falcon new_engine doesn't start with 2013-05-13 18:17:00 (GMT) commit, the latest as of this writing. Fedora 18, x86_64.
% gdb ./falcon
GNU gdb (GDB) Fedora (7.5.1-38.fc18)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...