Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Yuhi Ishikura uphy

💭
I may be slow to respond.
  • Saitama, Japan
  • Twitter @u_phy
View GitHub Profile
@uphy
uphy / zoom-mute.py
Created Dec 22, 2021
Mute Zoom Audio
View zoom-mute.py
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 Sep 24, 2021
Hide Obsidian's fold marker
View fold.css
.CodeMirror-gutter-elt {
display: none;
}
.CodeMirror-activeline .CodeMirror-gutter-elt {
display: block;
}
@uphy
uphy / ConnectTimeout.java
Created Oct 10, 2018
Artifically create connection timeout error
View ConnectTimeout.java
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 Apr 9, 2018
chackerv1config
View config.yml
service1:
host: host1
commands:
status:
steps:
- type: upload
local: foo/bar
remote: /tmp/hoge
- type: script
script: |
@uphy
uphy / node-red-multiline-shellscript.json
Last active Dec 14, 2020
Node-RED Execute multiline shell script
View node-red-multiline-shellscript.json
[{"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
View mkdocs.yml
site_name: My Docs
site_description: hogehoge
site_author: uphy
copyright: my copyright
dev_addr: 0.0.0.0:8000
theme: readthedocs
markdown_extensions:
- footnotes
pages:
@uphy
uphy / logstash-free.conf
Created Mar 9, 2017
logstash - free command
View logstash-free.conf
input {
exec {
command => "free -b"
interval => 10
}
}
filter {
grok {
match => {
"message" => ".*?Mem:\s*?%{NUMBER:total}\s*?%{NUMBER:used}\s*?%{NUMBER:free}\s*?%{NUMBER:shared}\s*?%{NUMBER:buffers}\s*?%{NUMBER:cached}\s*?\-/\+ buffers/cache:\s*?%{NUMBER:actual.used}\s*?%{NUMBER:actual.free}\s*?Swap:\s*?%{NUMBER:swap.total}\s*?%{NUMBER:swap.used}\s*?%{NUMBER:swap.free}.*"
View Wso2Client.java
package jp.uphy.wso2apim;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.List;
import javax.net.ssl.HttpsURLConnection;
View ResourceAdminServiceClientSample2.java
import org.apache.commons.httpclient.Header;
import org.wso2.carbon.endpoint.stub.types.EndpointAdminEndpointAdminException;
import org.wso2.carbon.registry.info.stub.RegistryExceptionException;
import org.wso2.carbon.registry.resource.stub.ResourceAdminServiceExceptionException;
import org.wso2.carbon.registry.resource.stub.ResourceAdminServiceStub;
import org.wso2.carbon.rest.api.stub.RestApiAdminAPIException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Base64;
View ResourceAdminServiceClientSample.java
import org.wso2.am.admin.clients.registry.ResourceAdminServiceClient;
import org.wso2.carbon.endpoint.stub.types.EndpointAdminEndpointAdminException;
import org.wso2.carbon.registry.info.stub.RegistryExceptionException;
import org.wso2.carbon.registry.resource.stub.ResourceAdminServiceExceptionException;
import org.wso2.carbon.rest.api.stub.RestApiAdminAPIException;
import java.rmi.RemoteException;
public class ResourceAdminServiceClientSample {