Skip to content

Instantly share code, notes, and snippets.

View eric100lin's full-sized avatar

Eric Lin (Tzu Hsiang Lin) eric100lin

  • Taiwan
  • 13:47 (UTC +08:00)
View GitHub Profile
@eric100lin
eric100lin / Check out NC lib
Created November 8, 2021 13:51
Before running `git submodule update --init --recursive` in https://github.com/google/nearby
git submodule add https://github.com/google/ukey2 third_party/ukey2
git submodule add https://github.com/protocolbuffers/protobuf third_party/protobuf
git submodule add https://github.com/google/googletest third_party/gtest
git submodule add https://github.com/abseil/abseil-cpp third_party/absl
git submodule add https://github.com/aappleby/smhasher third_party/smhasher
git submodule add https://chromium.googlesource.com/chromium/tools/depot_tools.git third_party/depot_tools
from mobly import base_test
from mobly import signals
from mobly import test_runner
from mobly.controllers import android_device
class HelloWorldTest(base_test.BaseTestClass):
def setup_class(self):
# Registering android_device controller module declares the test's
* Enabling Bluetooth in VirtualBox
https://scribles.net/enabling-bluetooth-in-virtualbox/
* Configure ubuntu 16.04 as Bluetooth A2DP Sink, i.e. Play Songs from mobile and listen on laptop-desktop speaker over Bluetooth – Lynxbee
https://www.lynxbee.com/configure-ubuntu-16-04-as-bluetooth-a2dp-sink-i-e-play-songs-from-mobile-and-listen-on-laptop-desktop-speaker-over-bluetooth/
* BluetoothUser-a2dp - Debian Wiki
https://wiki.debian.org/BluetoothUser/a2dp
* Bluetooth Class of Device List In Binary And Hexadecimal
https://www.question-defense.com/tools/class-of-device-bluetooth-cod-list-in-binary-and-hex
* Bluetooth Audio Receiver - A2DP Sink with Raspberry Pi – { the code ninja }
https://thecodeninja.net/2016/06/bluetooth-audio-receiver-a2dp-sink-with-raspberry-pi/
@eric100lin
eric100lin / WSL VTS Notes
Created October 6, 2020 06:58
2019/12/15 old notes
Install the Windows Subsystem for Linux
WSL is available only in 64-bit versions of Windows 10 from version 1607.
It is also available in Windows Server 2019.
Before installing any Linux distros for WSL,
you must ensure that the "Windows Subsystem for Linux" optional feature is enabled:
Open PowerShell as Administrator and run:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart your computer when prompted.
https://docs.microsoft.com/zh-tw/windows/wsl/install-win10
https://docs.microsoft.com/en-us/powershell/module/dism/enable-windowsoptionalfeature?view=win10-ps
* Show all commits from specific company
git log --pretty=format:"%h %Cblue%ad%Creset %ae %Cgreen%s%Creset" --author=google.com
* Show info about remote
git remote show origin
@eric100lin
eric100lin / StartWifiHotSpot.ps1
Last active December 12, 2019 04:20
Put these files in C:\Users\YOUR_USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
#https://superuser.com/questions/1174124/turn-on-mobile-hotspot-on-startup-windows-10
$a = [Windows.Networking.NetworkOperators.NetworkOperatorTetheringManager, Windows.Networking.NetworkOperators, ContentType=WindowsRuntime]::CreateFromConnectionProfile(
[Windows.Networking.Connectivity.NetworkInformation, Windows.Networking.Connectivity, ContentType=WindowsRuntime]::GetInternetConnectionProfile()
)
$a.StartTetheringAsync() # to start the Mobile hotspot
#$a.StopTetheringAsync() # to stop the Mobile hotspot
@eric100lin
eric100lin / raspberrypi4_notes.txt
Created October 18, 2019 06:51
Build raspberrypi4 image from Yocto Project
* Yocto Project Quick Build
https://www.yoctoproject.org/docs/2.7.1/brief-yoctoprojectqs/brief-yoctoprojectqs.html
* meta-raspberrypi
http://git.yoctoproject.org/cgit.cgi/meta-raspberrypi/about/?h=warrior
* Building Raspberry Pi Systems with Yocto
https://jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
* coldnew.github.io:
https://coldnew.github.io/c3e8558e/
https://coldnew.github.io/64f655a5/
* Useful bitbake commands
import collections
c = collections.Counter() # a new, empty counter
c = collections.Counter('gallahad') # a new counter from an iterable
c = collections.Counter({'red': 4, 'blue': 2}) # a new counter from a mapping
c = collections.Counter(cats=4, dogs=8) # a new counter from keyword args
c = collections.Counter(['eggs', 'ham', 'ham', 'chicken'])
n = c['bacon'] # count of a missing element is zero
c['sausage'] = 0 # counter entry with a zero count
del c['sausage'] # del actually removes the entry
print(list(c.elements())) # elements repeating each as many times as its count.
'''
Arithmetic Binary Tree
Hi, here's your problem today. This problem was recently asked by Apple:
You are given a binary tree representation of an arithmetic expression. In this tree, each leaf is an integer value,, and a non-leaf node is one of the four operations: '+', '-', '*', or '/'.
Write a function that takes this tree and evaluates the expression.
Example:
'''
Witness of The Tall People
Hi, here's your problem today. This problem was recently asked by Google:
There are n people lined up, and each have a height represented as an integer. A murder has happened right in front of them, and only people who are taller than everyone in front of them are able to see what has happened. How many witnesses are there?
Example:
Input: [3, 6, 3, 4, 1]
Output: 3