Skip to content

Instantly share code, notes, and snippets.

@ytomino
ytomino / bing-daily-wallpaper
Last active October 8, 2019 10:16
Use "bing Wallpaper" on macOS
#!/bin/bash
# Thanks to https://ubuntuforums.org/showthread.php?t=2074098
[[ -z "$HOME" ]] && exit 1
[[ -z "$TMPDIR" ]] && exit 1
# $bing is needed to form the fully qualified URL for
# the Bing pic of the day
bing="www.bing.com"
@ytomino
ytomino / darwin.shrc
Last active September 24, 2019 21:56
cd to the result of mdfind (Spotlight) / baloosearch
function mdcd {
local OPTARG OPTIND REPLY
local opt list dryrun query a s len home i ilen ihome
# switches
list=
dryrun=
OPTIND=
while getopts "ln" opt; do
case $opt in
l) list=1 ;;
@ytomino
ytomino / adaside.adb
Last active July 25, 2019 16:18
Ada tagged record derived from C++ class
package body adaside is
use type Interfaces.C.int;
function Constructor (n : Interfaces.C.int) return T is
begin
return (cppclass_hpp.Class_cppclass_t.New_cppclass_t (n)
with null record);
end Constructor;
overriding function get (this : access T) return Interfaces.C.int is
begin
return this.n_u * 2; -- replace the body
@ytomino
ytomino / commands_to_eisuu_kana.json
Created July 25, 2019 02:21
Commands to EISUU/Kana for Karabinar Elements
{
"title": "using",
"rules": [
{
"description": "Commands to EISUU/Kana",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command",
@ytomino
ytomino / userChrome.css
Created October 16, 2018 11:35
Make Firefox's minimize/maximize/close buttons to white for using Firefox's dark theme, in DE's white theme (KDE Breeze)
#titlebar-min,
#titlebar-max,
#titlebar-close {
/* -moz-appearance: -moz-window-button-minimize !important; */
-moz-appearance: none !important;
list-style-position: outside;
-moz-image-region: rect(0, 18px, 18px, 0);
padding: 0px 0px 0px 0px !important;
margin: 0px 0px 0px 4px !important;
}
@ytomino
ytomino / terror.py
Last active January 12, 2022 22:21
The reformatter for compiler's error messsages
#!/usr/bin/env python3
import fnmatch
import os
import re
import sys
msgtype = "gcc"
rootdir = os.getcwd()
workdir = rootdir
@ytomino
ytomino / gen-pc.sh
Last active November 24, 2017 11:57
Generate drake.pc for pkg-config
#!/bin/bash
function usage {
echo "$0 [--gcc=...] [--name=...] --RTS=... > FILENAME.pc" > /dev/stderr
exit 1
}
LOG=/dev/null
URL=https://github.com/ytomino/drake
@ytomino
ytomino / c-alloca.ads
Last active November 4, 2020 19:27
**experimental** x32 ABI on x86_64-pc-linux-gnu
-- This file is translated by "headmaster" version 0.30-886eb78 (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
with C.stddef;
package C.alloca is
pragma Preelaborate;
function alloca (size : stddef.size_t) return void_ptr;
pragma Import (C, alloca, "alloca");
@ytomino
ytomino / .zprofile.sh
Last active October 30, 2017 09:40
command not foundと相対パスcdを弾くzshaddhistory
function zshaddhistory {
local cmdline cmd dir
cmdline=( ${=1} )
if [[ ${cmdline[1]} =~ '[`(]' ]]; then
return 0 # do not want to exec something on expansion
else
cmd=${(e)~cmdline[1]}
if [[ ${cmd} == cd ]]; then
if [[ ${cmdline[2]} =~ '[`(]' ]]; then
return 0 # do not want to exec something on expansion
@ytomino
ytomino / c-alloca.ads
Last active November 4, 2020 23:53
x86_64-apple-darwin13
-- This file is translated by "headmaster" version 0.30-18d0286 (devel).
-- The original C header's license should be applied to this file.
-- All conditional-directives are expanded for the exclusive use of your
-- environment, it is not recommended to commit this file to any repository.
-------------------------------------------------------------------------------
with C.stddef;
package C.alloca is
pragma Preelaborate;
function alloca (a1 : stddef.size_t) return void_ptr;
pragma Import (C, alloca, "alloca");