Skip to content

Instantly share code, notes, and snippets.

@ytomino
ytomino / bing-daily-wallpaper
Last active Oct 8, 2019
Use "bing Wallpaper" on macOS
View bing-daily-wallpaper
#!/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 Sep 24, 2019
cd to the result of mdfind (Spotlight) / baloosearch
View darwin.shrc
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 Jul 25, 2019
Ada tagged record derived from C++ class
View adaside.adb
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 Jul 25, 2019
Commands to EISUU/Kana for Karabinar Elements
View commands_to_eisuu_kana.json
{
"title": "using",
"rules": [
{
"description": "Commands to EISUU/Kana",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_command",
@ytomino
ytomino / userChrome.css
Created Oct 16, 2018
Make Firefox's minimize/maximize/close buttons to white for using Firefox's dark theme, in DE's white theme (KDE Breeze)
View userChrome.css
#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 Jul 3, 2020
The reformatter for compiler's error messsages
View terror.py
#!/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 Nov 24, 2017
Generate drake.pc for pkg-config
View gen-pc.sh
#!/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 Nov 12, 2017
**experimental** x32 ABI on x86_64-pc-linux-gnu
View c-alloca.ads
-- This file is translated by "headmaster" version 0.28-9ebd462 (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 / rst2rst.py
Created Oct 31, 2017
rtf2rtf: convert rtf to human friendly rtf.
View rst2rst.py
#!/usr/bin/env python
import codecs, locale, re, sys
if len(sys.argv) > 1 and sys.argv[1] == '-h':
print "rtf2rtf: convert rtf to human friendly rtf."
exit(0)
def sep(s):
c = s[0]
@ytomino
ytomino / .zprofile.sh
Last active Oct 30, 2017
command not foundと相対パスcdを弾くzshaddhistory
View .zprofile.sh
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
You can’t perform that action at this time.