Skip to content

Instantly share code, notes, and snippets.

Avatar

Takeshi Yako takeshiyako2

View GitHub Profile
@takeshiyako2
takeshiyako2 / Power Control TP-Link HS105 by tplink-smarthome-api on macOS.md
Last active Feb 5, 2021
Power Control TP-Link HS105 by tplink-smarthome-api on macOS
View Power Control TP-Link HS105 by tplink-smarthome-api on macOS.md
@takeshiyako2
takeshiyako2 / Raspberry Pi 4 Model B - USB power ON-OFF - uhubctl.md
Last active Jul 11, 2021
Raspberry Pi 4 - USB power ON/OFF by uhubctl
View Raspberry Pi 4 Model B - USB power ON-OFF - uhubctl.md

Issue

I want to USB power ON/OFF on Raspberry Pi 4.
Raspberry Pi 4でUSBパワーをON/OFFしたい。

Raspberry PiのUSBポートに直接LEDライトを接続してオンオフを試しました。
ここでは、https://github.com/mvp/uhubctl というユーティリティを使います。
https://github.com/codazoda/hub-ctrl.c も、だいたい同じことができるようですが、こちらの uhubctl の方が扱いやすそうだったので、こちらを選びました。

個別のUSBポートのパワーのON/OFFはできないようで、全てのUSBポートのパワーを一緒に操作しています。

@takeshiyako2
takeshiyako2 / Info.plist
Last active Feb 7, 2017
iOS Objective-C against kCFStreamErrorDomainSSL error
View Info.plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>mydomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
@takeshiyako2
takeshiyako2 / default.conf
Created Sep 12, 2016
nginx ngx_http_geoip_module with AWS ELB
View default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
if ($allowed_country = yes) {
set $exclusions 1;
}
@takeshiyako2
takeshiyako2 / renew_ip_address_test.xml
Created Aug 25, 2016
Change Route53 IP address by dnscurl.pl
View renew_ip_address_test.xml
<?xml version="1.0" encoding="UTF-8"?>
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<ChangeBatch>
<Changes>
<Change>
<Action>DELETE</Action>
<ResourceRecordSet>
<Name>test.hitokoto.co.</Name>
<Type>A</Type>
<TTL>300</TTL>
@takeshiyako2
takeshiyako2 / td-agent.conf
Created Jul 27, 2016
fluent-plugin-google-cloud-storage-out config sample
View td-agent.conf
# tail
<source>
type tail
format /^(?<date>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) (?<status>\S+) \[(?<role>\S+)\] (?<info>.*)$/
path /tmp/application.log
pos_file /var/log/td-agent/myapp.application.pos
tag td.myapp.application
</source>
<match td.myapp.application>
@takeshiyako2
takeshiyako2 / default.conf
Last active Aug 3, 2017
WordPress + Varnish (Varnish port 80 -> nginx port 8080 -> php-fpm)
View default.conf
# /etc/nginx/conf.d/default.conf
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/wordpress;
index index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
@takeshiyako2
takeshiyako2 / eccube.conf
Created Jan 14, 2016
EC-CUBE3 nginx config
View eccube.conf
server {
listen 80;
root /var/www/eccube/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 500 502 503 504 /50x.html;
@takeshiyako2
takeshiyako2 / 017_historia.conf
Last active Jan 20, 2016
nginx ssl settings sample for A++
View 017_historia.conf
server {
listen 443;
server_name historia.hitokoto.co;
root /var/www/historia;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css text/javascript application/json;
ssl on;
@takeshiyako2
takeshiyako2 / AndroidManifest.xml
Created Dec 18, 2015
Android AdMob Interstitial
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.admob.com.admobinterstitialtest">
<!-- Include required permissions for Google Mobile Ads to run. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"