Skip to content

Instantly share code, notes, and snippets.

View mngyuan's full-sized avatar

Kevin Lee mngyuan

View GitHub Profile
@mngyuan
mngyuan / SD_Card_Sensors.ino
Created April 21, 2022 22:21
SD_Card_Sensors.ino merged with Motors_Radio_Controller.ino
// @mngyuan: below follows a list of what i did
// copied definitions from Motors_Radio_Controller to top section of file
// copied setup() from Motors_Radio_Controller into setup() function
// copied loop() from Motors_Radio_Controller into loop() function
// changed value of CURRENT_SEN_1 and EN_PIN_1 to not clash with SD card code
// commented extra Serial.begin() from SD card's setup()
// formatted code with clang-format set to Google config
//
// notes:
// * the sd card code hardcodes pin 53 as your SS pin, but it varies based on
@mngyuan
mngyuan / virgin-media.mobileconfig
Last active November 3, 2022 18:45
Connect to Virgin Media hotspot on a MacOS/iOS device using .mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!--
Adapted from the .mobileconfig which the Virgin Media iOS app downloads. Essentially removed the
signing payload. This approach is necessary because AFAIK it's the only way to select MSCHAPv2
as the auth method for EAP TTLS in macOS.
Replace VIRGINUSER with your Virgin login email and VIRGINPASSWORD with your password,
then open and then open System Preferences to install.
@mngyuan
mngyuan / open_random_film_photo.sh
Created February 16, 2022 02:18
Open a random photo from my film photos
#!/bin/zsh
FILELIST=$( find *film -maxdepth 2 -mindepth 2 -type f -print )
RANDOMFILE=$( echo $FILELIST | sort --random-sort | head -n 1 )
echo $RANDOMFILE
open $RANDOMFILE
@mngyuan
mngyuan / make-slippi-replay-mp4.sh
Last active November 9, 2021 22:47
ffmpeg command to make an mp4 from a dolphin emulator dump from slippi
#!/bin/zsh
# requires ffmpeg
#
# you may need to change "framedump1.avi" to "framedump0.avi" or similar, but it's always "framedump1.avi" for me
cd ~/Library/Application\ Support/Slippi\ Launcher/playback/Slippi\ Dolphin.app/Contents/Resources/User/Dump
ffmpeg -i Frames/framedump1.avi -i Audio/dspdump.wav -map 0:v -map 1:a -c:v copy -shortest output.mp4
# add a bottom part so it's vertical aspect ratio so it can be uploaded to YouTube shorts
ffmpeg -i output.mp4 -i ~/Desktop/overlay.png -filter_complex vstack=inputs=2 -r 60 output-vertical.mp4
@mngyuan
mngyuan / gist:12bdf1990333495813e1c6188a6a542d
Created October 18, 2020 22:27
Download video and transcode to macOS friendly HEVC h265 mp4
# usage: ./download.sh example-file.m3u8 output-name
# credit @brandur see https://brandur.org/fragments/ffmpeg-h265
ffmpeg -i "$1" -c:v libx265 -crf 35 -preset fast -tag:v hvc1 -c:a eac3 -b:a 224k $2.mp4
@mngyuan
mngyuan / 夢.txt
Last active September 26, 2020 22:18
大家好!我是李梦远。我在找机会练习我的中文。要是你想跟我谈一谈一起练,请送我个短信!@mngyuan
d | | i
r ------|------|------ n
e ___|______|___ g
a | | | |
m |___|____|___| d
/-----------------/ r
d / /________ / e
r _/ / a
@mngyuan
mngyuan / basic-site-with-router.js
Created June 20, 2020 01:35
Vanilla react site with redux style router
import React from 'react';
const Home = ({dispatch, currentRoute}) => {
<span>
You're at Home {currentRoute}.
<a onClick={() => dispatch({type: 'PUSH', path: '/about'})}>
About
</a>
</span>
};
@mngyuan
mngyuan / dribbble_gif_creation.md
Last active May 28, 2020 01:01
Create nice GIFs of screen recordings, for dribbble or otherwise

Convert a screen recording into a GIF using ffmpeg

Record the screen

on MacOS:

  • ⇧⌘5 to record part of the screen
  • record with intended final aspect ratio if not padding
  • trim recording appropriately
@mngyuan
mngyuan / uninstall-zoom.sh
Last active April 4, 2020 22:39
Fully uninstall Zoom for Mac
# context:
# list of privacy and security concerns:
# https://techcrunch.com/2020/03/31/zoom-at-your-own-risk/
# july 2019 exploit:
# https://www.theverge.com/2019/7/9/20688113/zoom-apple-mac-patch-vulnerability-emergency-fix-web-server-remove
# open zoom -> click zoom.us next to File -> Uninstall Zoom
# then:
# delete application
sudo rm -rf /Applications/zoom.us.app
@mngyuan
mngyuan / .gitlab-ci.yml
Created February 6, 2020 21:01
Gitlab CI config for nextjs
image: node:alpine
# Cache node modules - speeds up future builds
cache:
paths:
- node_modules
pages:
stage: deploy
script: