Skip to content

Instantly share code, notes, and snippets.

View takeshiyako2's full-sized avatar

Takeshi Yako takeshiyako2

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

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 February 7, 2017 02:03
iOS Objective-C against kCFStreamErrorDomainSSL error
<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 September 12, 2016 08:41
nginx ngx_http_geoip_module with AWS ELB
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 August 25, 2016 06:42
Change Route53 IP address by dnscurl.pl
<?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 July 27, 2016 06:14
fluent-plugin-google-cloud-storage-out config sample
# 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 August 3, 2017 19:55
WordPress + Varnish (Varnish port 80 -> nginx port 8080 -> php-fpm)
# /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 January 14, 2016 05:47
EC-CUBE3 nginx config
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 January 20, 2016 05:40
nginx ssl settings sample for A++
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 December 18, 2015 08:49
Android AdMob Interstitial
<?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"