Skip to content

Instantly share code, notes, and snippets.

@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
sort.sh - sort wrapper for saving original order of lines which have the same key values.

sort.sh

This script is the sort wrapper for saving original order of lines which have the same key values.

Usage

sort.sh [OPTIONS ...] [FILES ...]
Options:
  See help or manpage of sort commnand.
@kou1okada
kou1okada / Makefile
Last active November 1, 2018 07:06
maginfo - An example of Windows Magnification API
.PHONY: all clean
TARGETS=maginfo
LIBS=`cygpath -S`/Magnification.dll
all: $(TARGETS)
maginfo: maginfo.cpp
$(CXX) -o $@ $< $(LIBS)
@kou1okada
kou1okada / moodlehacks.js
Last active October 25, 2018 15:07
Moodle hacks
/**
* Get route of current page.
* \return Hash object which has keys (module, controller and any optionals) and values.
* module is like "course", "assign", "data", etc...
* controller is like "view", "modedit", "edit", etc...
* optionals are like "add", "course", "section", "mode", etc...
*/
function getroute() {
let route = {};
if (location.href.match(/\/([^/]+)\/([^/]+)\.php(\?(.*))/)) {
@kou1okada
kou1okada / README.md
Last active February 7, 2025 02:36
getpw.bash - Get password with masked echo back.

getpw.bash - Get password with masked echo back

Examples

Call as a command:

: ${PASSWORD:=$(getpw.bash)}
@kou1okada
kou1okada / LookupAccountName.c
Last active July 29, 2021 20:02
wautils: Windows Account Utilities
/**
* LookupAccountName
* Copyright (c) 2018 Koichi OKADA. All rights reserved.
* This source code is distributed under the MIT license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winbase.h>
#include <sddl.h>
@kou1okada
kou1okada / README.md
Last active January 11, 2022 11:52
dpkg-installedsize: Show installed sizes of each installed deb package.

dpkg-installedsize: Show installed size of each installed deb package.

Usage

Usage: dpkg-installedsize [OPTIONS]
Options:
  -f FMT       Set format (default: "%'9d KiB\t%s\n")
  -n           Sort with package name
 -s Sort with installed size
@kou1okada
kou1okada / README.md
Last active August 10, 2018 00:25
Registry entry of "Windows Photo Viewer" for Windows 10.

Registry entry of Windows Photo Viewer for Windows 10

photoviewer.dll.VPCZ21AJ.reg is exported from Windows 10 Pro on SONY VAIO Z VPCZ21AJ that upgraded from Windows 7 Professional.

photoviewer.dll.win10pro.reg is exported from clean installed Windows 10 Pro.

Result of diff command is below:

$ diff -ca photoviewer.dll.win10pro.reg photoviewer.dll.VPCZ21AJ.reg
*** photoviewer.dll.win10pro.reg 2018-08-09 20:33:12.735871000 +0900
@kou1okada
kou1okada / moodlexmlutil.rb
Last active March 12, 2018 10:19
moodlexmlutil.rb - Utility for xml file of moodle backup.
#!/bin/sh
exec ruby -x "$0" "$@"
#!ruby
# coding: utf-8
require "optparse"
require "logger"
require "hpricot"
$conf = {
@kou1okada
kou1okada / zs.sh
Last active January 11, 2022 11:52
zs.sh - ZipS: Choose the best compression.
#!/usr/bin/env bash
#
# zs.sh - ZipS: Choose the best compression
# Copyright (c) 2018 Koichi OKADA. All rights reserved.
# This script is distributed under the MIT license.
#
(( 5 <= DEBUG )) && set -x
function usage ()
@kou1okada
kou1okada / fireworks.pde
Last active February 25, 2024 11:06
Fireworks for Processing
/**
* Fireworks for Processing
* Copyright (c) 2018 Koichi OKADA. All rights reserved;
* This code is distributed under the MIT license.
*/
int MaxLife = 255;
int N = 500;
class Fire {