Skip to content

Instantly share code, notes, and snippets.

@masnagam
masnagam / file0.coffee
Last active October 28, 2017 03:06
Emacsを使って既存のファイルを編集していると,gulp.watch内でクラッシュが発生する問題の回避方法 ref: http://qiita.com/masnagam/items/33f4ae8a663539627b94
gulp.watch ['path/to/**/*.coffee'], ['compile']
@masnagam
masnagam / SwingHTMLBrowser.java
Created November 18, 2014 09:06
simple web browser using java.swing.JEditorPane
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.html.*;
public class SwingHTMLBrowser extends JFrame implements ActionListener, HyperlinkListener {
private JTextField addressBar;
private JEditorPane pane;
#!/bin/bash
usage() {
echo 'sh reproduce.sh path/to/existing/empty/folder'
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
'use strict';
function getDepth(element, depth) {
let maxDepth = depth;
for (let i = 0; i < element.children.length; ++i) {
let childDepth = getDepth(element.children[i], depth + 1);
if (maxDepth < childDepth) {
maxDepth = childDepth;
}
}
'use strict';
let elements = document.querySelectorAll('*');
let tags = {};
for (let i = 0; i < elements.length; ++i) {
const tagName = elements[i].tagName;
if (tags[tagName] === undefined) {
tags[tagName] = 1;
} else {
tags[tagName] = tags[tagName] + 1;
'use strict';
const $ = require('jquery');
const html2canvas = require('html2canvas');
if (ARGS.length < 2) {
throw new Error('Selector is required');
}
const selector = ARGS[0];
@masnagam
masnagam / install-docker-compose
Last active April 21, 2019 16:11
Install docker-compose
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
BRANCH=
INSTALL_DIR=/usr/local/bin
CLEAN=no
@masnagam
masnagam / install-px4-drv
Last active September 22, 2019 05:40
Install nns779/px4_drv
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
DKMS=no
ACTION=
DEPS="curl gcc make python unzip"
@masnagam
masnagam / make-iscsi-rootfs
Last active April 22, 2019 12:17
Creates rootfs in a specified iSCSI storage
#!/bin/sh
set -eu
PROGNAME=$(basename $0)
BASEDIR=$(cd $(dirname $0); pwd)
COPY_BOOT=n
ISCSI_PORTAL=
ISCSI_TARGET=
@masnagam
masnagam / rock64-armbian-build-missing-files-for-building-driver
Last active May 21, 2019 02:19
Build missing files required for building drivers (Armbian linux-headers-rockchip64 has been broken)
#!/bin/bash
# Armbian linux-headers-rockchip64 for 4.4.xxx-rockchip64 has been broken.
# Several files required for building drivers are missing.
#
# * https://forum.armbian.com/topic/9540-linux-headers-rk3399-is-broken-for-building-out-of-tree-modules-with-fix/
# * https://forum.armbian.com/topic/9602-linux-headers-41920-cubox-make-scripts-fails/
# * https://forum.armbian.com/topic/873-solved-compiling-drivers-error-no-header-files-found/
# Reboot before running this script if you have been just upgraded kernel.