Skip to content

Instantly share code, notes, and snippets.

View uphy's full-sized avatar
💭
I may be slow to respond.

Yuhi Ishikura uphy

💭
I may be slow to respond.
View GitHub Profile
@uphy
uphy / deliverable.cue
Created October 14, 2022 02:45
CUE: File content injection
#Embed: {
files: [string]: string
}
#Resource: {
#embed: [string]: #Embed | *{}
...
}
#Deliverable: {
@uphy
uphy / ExpandableListView.java
Last active June 2, 2023 20:54
JavaFX Expandable ListView
/**
* Copyright (C) 2015 uphy.jp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#!/bin/bash
#
# glassfish: Startup script for Glassfish Application Server.
#
# chkconfig: 3 80 05
# description: Startup script for domain1 of Glassfish Application Server.
export GLASSFISH_HOME=/usr/local/glassfish/glassfish
export GLASSFISH_OWNER=glassfish
export JAVA_HOME=/usr/local/java
@uphy
uphy / zoom-mute.py
Created December 22, 2021 04:52
Mute Zoom Audio
import subprocess
def set_zoom_audio_muted(muted:bool):
subprocess.run("""osascript -e '
on setAudioMuted(muted)
activate application "zoom.us"
delay 0.5
tell application "System Events"
tell process "zoom.us"
tell window "Zoomミーティング"
@uphy
uphy / fold.css
Created September 24, 2021 01:08
Hide Obsidian's fold marker
.CodeMirror-gutter-elt {
display: none;
}
.CodeMirror-activeline .CodeMirror-gutter-elt {
display: block;
}
@uphy
uphy / AndroidApplicationRestart.java
Last active August 20, 2021 03:00
Androidで、アクティビティではなく、アプリケーションレベルの再起動を行う。
final Intent i = new Intent(getApplicationContext(), ContentActivity.class);
final PendingIntent appStarter = PendingIntent.getActivity(getApplicationContext(), 0, i, 0);
final AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, appStarter);
Process.killProcess(Process.myPid());
@uphy
uphy / node-red-multiline-shellscript.json
Last active December 14, 2020 15:36
Node-RED Execute multiline shell script
[{"id":"1a73c740.e06d79","type":"subflow","name":"Execute Shell Script","info":"","in":[{"x":100,"y":200,"wires":[{"id":"662c3c62.43d624"}]}],"out":[{"x":960,"y":280,"wires":[{"id":"9e92978.d8d0868","port":0}]},{"x":960,"y":340,"wires":[{"id":"9e92978.d8d0868","port":1}]},{"x":960,"y":400,"wires":[{"id":"9e92978.d8d0868","port":2}]}]},{"id":"dda86e6b.3b362","type":"file","z":"1a73c740.e06d79","name":"Write script file","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","x":860,"y":140,"wires":[]},{"id":"7a2a96f.a52b268","type":"exec","z":"1a73c740.e06d79","command":"mktemp","addpay":false,"append":"","useSpawn":"","timer":"","name":"","x":420,"y":200,"wires":[["9131a546.667eb8"],[],[]]},{"id":"c9fb5364.0becc","type":"file","z":"1a73c740.e06d79","name":"Delete script file","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"delete","x":1020,"y":480,"wires":[]},{"id":"9e92978.d8d0868","type":"exec","z":"1a73c740.e06d79","command":" sh ","addpay":true,"append":"","useS
@uphy
uphy / ConnectTimeout.java
Created October 10, 2018 10:05
Artifically create connection timeout error
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
import java.net.URL;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
URL url = new URL("http://10.255.255.1:8080");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(1000);
@uphy
uphy / config.yml
Created April 9, 2018 08:56
chackerv1config
service1:
host: host1
commands:
status:
steps:
- type: upload
local: foo/bar
remote: /tmp/hoge
- type: script
script: |
/**
* Copyright (C) 2016 uphy.jp
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and