Skip to content

Instantly share code, notes, and snippets.

@AlekseyMko
AlekseyMko / change-codec.md
Created June 3, 2023 08:33 — forked from dvf/change-codec.md
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

/*
Reddit DailyProgrammer Challenge #180 -- Tamagotchi Emulator
By Aerospark12 (aka Luke)
I may have gone a little bit overboard with this one, but I've got fond memories of tamagotchi from when
I was but a wee laddie, I've always wanted to make something like this, and I really enjoy graphics and animation
The design of this is partially inspirte by how I understand "low level" ICs to work, as an homage to the real tamagotchi
myUser=`whoami`
SYNO_USER=`psql synofoto -t -c "select id from user_info where name='$myUser'"`
for i in `find 2017 -iname \*.mov -type f | grep -v eaDir | grep -v "_3"`; do
fname=$(dirname ${i})/@eaDir/$(basename ${i})/SYNOPHOTO_FILM_H.mp4;
foldername=/$(dirname $i)
filename=$(basename $i)
video_id=`psql synofoto -t -c "select video.id from video join unit on unit.id = video.id where unit.id_folder = (select id from folder where name='$foldername' and id_user=$SYNO_USER) and unit.filename='$filename'"`
video_convert_present=`psql synofoto -t -c "select id_unit from video_convert where id_unit=$video_id"`
if [ -z "$video_convert_present" ]; then
@AlekseyMko
AlekseyMko / latency.markdown
Created April 27, 2017 10:54 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@AlekseyMko
AlekseyMko / latency.markdown
Created April 27, 2017 10:54 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs