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 <echochamber@gmail.com>
" 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/zsh
# Bind BackSpace key for Caps_Lock.
/usr/bin/xmodmap -e 'keycode 66 = BackSpace'
/usr/bin/xmodmap -e 'remove Lock = BackSpace'
/usr/bin/xset r 66
# Bind Caps_Lock key for BackSpace.
/usr/bin/xmodmap -e 'keycode 22 = Caps_Lock'
/usr/bin/xmodmap -e 'add Lock = Caps_Lock'
#!/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="$@"
// 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/>...
#!/bin/zsh -x
# ファイルに変更があったらブラウザを自動リロードする。
# ブラウザ側に拡張などを入れる必要なし。
# 要: inotifywait, xdotool
# 参考: http://stackoverflow.com/questions/4680109/how-to-reload-refresh-a-web-page-without-leaving-my-web-development-ide/10739606#10739606
# 参考: http://unix.stackexchange.com/questions/37258/refresh-reload-active-browser-tab-from-command-line/42933#42933
RELOAD_KEYS="CTRL+R"
# RELOAD_KEYS="SHIFT+CTRL+R"