This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Yet Another PowerShell profile | |
# | |
# Copyright (c) 2020. Michael Chen. Licensed under Apache 2.0. | |
# Tested against PowerShell 7. | |
# Show the version of PowerShell. | |
function Version { | |
Get-Host | Select-Object Version | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* copyright (c) 2020 Michael chen. | |
Licensed under Apache 2.0 */ | |
#include <stdio.h> | |
#include <Block.h> | |
typedef unsigned (^uint_block)(void); | |
typedef uint_block (^uint_closure)(void); | |
int main(void) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2020 Michael Chen. | |
Licensed under Apache 2.0 */ | |
func swiftVersionMajor () -> UInt { | |
#if swift(>=5.0) | |
return 5 | |
#elseif swift(>=4.0) | |
return 4 | |
#elseif swift(>=3.0) | |
return 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ie9 () { | |
let div = document.createElement("div"); | |
div.innerHTML = "<!--[if lte IE 9]><i></i><![endif]-->"; | |
return div.getElementsByTagName("i").length == 1; | |
} | |
function getXHR() { | |
if (ie9()) { | |
try { | |
return new ActiveXObject('Microsoft.XMLHTTP'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Utility to add an event listener for an element. */ | |
function addEvent (event, elem, func) { | |
if (elem.addEventListener) | |
elem.addEventListener(event, func, false); | |
else if (elem.attachEvent) | |
elem.attachEvent('on'+event, func); | |
else | |
elem[event] = func; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# deploy2win - Deploy a MSYS2 executable to native Windows environment | |
# | |
# Copyright (c) 2020, Michelle Chen. Licensed under MIT. | |
target="$1" | |
# Check whether `$target` is an executable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install the dependencies of GNUstep on openSUSE. | |
# Copyright (c) 2020 Michael Chen. Licensed under MIT. | |
# Note: | |
# | |
# Currently, GNUstep GUI fails to compile due to ImageMagick issue. | |
# Subsequently, GUNstep Backend fails to compile as well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jmdict2sqlite.groovy - Load JMdict into a SQLite database. | |
Copyright (c) 2020 Michael Chen. | |
Licensed under MIT. | |
Copy JMdict_e to the same path of the script. | |
Then, run it with the following command: | |
$ groovy -cp path/to/sqlite-jdbc-3.30.1.jar -DentityExpansionLimit=1000000 jmdict2sqlite.groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* kedict2sqlite.groovy - Load kedict into a SQLite database. | |
Copyright (c) 2020 Michael Chen. | |
Licensed under MIT. | |
Copy kedict.yml to the same path of the script. | |
Then, run it with the following command: | |
$ groovy -cp path/to/sqlite-jdbc-x.y.z.jar kedict2sqlite.groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
rem Build script for Clojure on Windows | |
rem Copyright (c) 2020 Michael Chen | |
rem Licensed under MIT | |
rem Place the script at the scripts/ subdirectory of of a local Clojure repo. | |
rem *TODO* Use system Maven to compile Clojure | |
set script_path=%~dp0 |
NewerOlder