Skip to content

Instantly share code, notes, and snippets.

View willzhang05's full-sized avatar

William Zhang willzhang05

View GitHub Profile
std::vector<int> customSortNumbers(std::vector<int> arr) {
// arr[0] = 1
// count[1] = 1
// count[arr[i]]
// map
/*
{1, 1}
{2, 3}
{4, 2}
*/
@willzhang05
willzhang05 / solarcaratuva-stm32-mbed-info.md
Last active March 14, 2020 19:20
STM32 Development Info

STM32 Development Info

MCU Info

  • The STM32 board that we are currently evaluating is the Nucleo-H743ZI.
  • The target STM32 SKU is the STM32H743, which is a single-core MCU that can run up to 480 MHz.
  • There are many other SKUs in the STM32 family; we may want to evaluate a lower-cost/more stripped down SKU, or if needed, dual core versions such as the STM32H745.

RTOS Info

The RTOS currently being considered is Mbed OS.

  • Open source
  • Many built-in libraries (especially for connectivity)
@willzhang05
willzhang05 / solarcaratuva-teensy-software-setup.md
Last active March 7, 2020 22:54
PCBv3 Development Environment Setup

PCBv3 Development Environment Setup

The KiCAD PCB design files and the ECU code are located in the EmbeddedSystem repository.

Code Development

  • Install the Arduino IDE.
  • Install the Teensyduino add-on.
  • Go to the Teensyduino install location and delete the included version of FlexCAN.
    • On Linux, this is located at /usr/share/arduino/hardware/teensy/avr/libraries/FlexCAN.
  • Replace the FlexCAN folder by cloning the fork of the FlexCAN library by pawelsky into the same location.
  • To build the lights code, the Arduino "Chrono" library will need to be installed.
  • In the Arduino IDE, go to Tools &gt; Manage Libraries.

Removing a Mac's Firmware Password By Reflashing EFI ROM

According to Apple, the only way to remove an unknown firmware password from a MacBook (2011 and later) is to take it to the Apple Store with the original proof-of-purchase. However, I've found that there is another way, which I've been successful with for the unibody MacBook Pro--it's essentially just modifying a couple bytes in the EFI ROM, which should be simple. What's not simple, however, is figuring out how to read and write to the EFI chip. In this post, I'll talk about the process that I figured out and what worked for me.

The Official Method

Apple's method of resetting the firmware password is not reproducible, as Apple generates an SCBO file that unlocks the EFI using their private key. You can read more about this process here. The problem with this system is that, if you are in the unfortunate situation of neither having the firmware unlock pass

Get-WmiObject -Class Win32_UserAccount
Rename-LocalUser -Name Guest -NewName EdWaterGuest
Rename-LocalUser -Name Administrator -NewName BigParserWinner
Get-LocalUser Guest | Disable-LocalUser
Get-LocalUser Administrator | Disable-LocalUser
wget https://data-cdn.mbamupdates.com/web/mb3-setup-consumer/mb3-setup-consumer-3.3.1.2183-1.0.262-1.0.3850.exe -OutFile mb-setup.exe
wget https://data-cdn.mbamupdates.com/web/mbar-1.10.3.1001.exe -OutFile mbar-setup.exe
wget https://download.microsoft.com/download/8/E/1/8E16A4C7-DD28-4368-A83A-282C82FC212A/MBSASetup-x64-EN.msi -OutFile mbsa-setup.exe
@willzhang05
willzhang05 / django-setup.md
Last active July 14, 2018 01:16
Django project setup

I like to use virtualenvs for Django projects for the convenience.

  • virtualenv -p <python version> <env name>
  • source env/bin/activate
  • pip install django
  • django-admin startproject <project name>
  • django-admin startapp <app name>
  • python manage.py migrate

I also typically update the dependencies for the project in requirements.txt

  • pip freeze &gt; requirements.txt
@willzhang05
willzhang05 / codein-2017-ubuntu-install.md
Last active December 8, 2017 14:31
Ubuntu 17.10 Desktop Libvirt Install (Arch Linux hypervisor)

Run everything as root

mkdir /vms
cd /vms
wget http://mirror.rit.edu/ubuntu-releases/17.10/ubuntu-17.10-desktop-amd64.iso
mv ubuntu-17.10-desktop-amd64.iso ubuntu-desktop.iso
mkdir codein
cd codein
qemu-img create -f qcow2 codein 20G
echo <<< EOL
## AMT Relay discovery ##
* Need anycast address of AMT Relay (233.44.15.9)
* AMT gateway sends AMT Relay Discovery message to anycast address (233.44.15.9)
* Find closest relay using routing table
* Send message to UDP port 2268 and has Nonce
* Relay responds to Gateway with AMT Relay Advertisement message
* Gateway receives message with Relay's unique IP address.
* Gateway uses this IP address for any AMT messages (AMT Requests/AMT Membership updates) sent to this specific Relay
* Relay replies using UDP Port 2268 and contains the same Nonce that the Gateway verifies is the same,

William Zhang | Website | GitHub | Flickr

Academics:

Thomas Jefferson High School for Science and Technology, Alexandria, VA (2014 – Present)

  • Accelerated Computer Science (Python)
  • APCS (Java)
  • Currently taking Analog Electronics and Parallel Computing (C)
  • Currently studying systems administration and networking
Experience:
@willzhang05
willzhang05 / keybase.md
Created September 16, 2016 19:03
chickens taste awesome

Keybase proof

I hereby claim:

  • I am willzhang05 on github.
  • I am willzhang05 (https://keybase.io/willzhang05) on keybase.
  • I have a public key whose fingerprint is 38DA 73E3 5989 6431 22A3 2784 C0BA 3A2B 5CF4 10DC

To claim this, I am signing this object: