Skip to content

Instantly share code, notes, and snippets.

View takeshiyako2's full-sized avatar

Takeshi Yako takeshiyako2

View GitHub Profile
@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 / AndroidManifest.xml
Last active May 29, 2023 15:48
Android Sample YouTube API on the Fragment
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="xxxx.xxxx.xxxx.fragmentdeyoutube" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@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"
@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 / AndroidManifest.xml
Last active September 27, 2020 05:08
Android Volley Sample
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yako.volleyinstalltest" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="AppController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@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 / MainActivity.java
Created July 31, 2015 01:44
Android Sample Open Facebook Page
package facebook.page.test;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
#/usr/lib/nagios/plugins/check_domain
#nagios plugins
#original:
#http://exchange.nagios.org/directory/Plugins/Internet-Domains-and-WHOIS/check_domain/details
#
#this plugins can check
# example.co.jp (level 3 domain)
# example.jp (level 2 domain)
#
#usage:
@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 / 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/>