Skip to content

Instantly share code, notes, and snippets.

View thetrung's full-sized avatar

Nguyễn Thế Trung thetrung

View GitHub Profile
@thetrung
thetrung / main.c
Created September 26, 2024 16:34
ESP32 Fetch BTC price from CoinDesk API
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ArduinoJson.h>
// Change ID/PWD
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C Address of LCD 16x02
@thetrung
thetrung / main.c
Created September 14, 2024 13:55
ATMega8_Rescue_ATMega32A
#include <avr/io.h>
#include <util/delay.h>
#define HFUSE 0xDF // Default for ATmega48/88/168, for others see
#define LFUSE 0x62 // http://www.engbedded.com/cgi-bin/fc.cgi
/*
#define DATA PORTD // PORTD = Arduino Digital pins 0-7
#define DATAD DDRD // Data direction register for DATA port
#define VCC 8 PB0
@thetrung
thetrung / PICKIT3_Tricks.md
Last active September 12, 2024 19:47
Pickit-3 on Ubuntu/IDE 6.20+

PICKIT-3 Programmer Tricks

When I first bought this old buddy, I thought it was dead, corrupted or something wrong there. But then, I figured it out after some late nights that it still work flawlessly with even latest MPLAB X IDE/IPE 6.20 on Ubuntu 24.04.1, even when USB Tools keep showing errors about some libusb_AccessLink_xyz not found. So lemme save you a day of googling ;)

1. Old firmware :

It does work flawlessly with Pickit-3 Programmer Standalone 3.10 Application but doesn't on MPLAB X IDE/IPE 6.20+.

  • This is because yours was flashed with old firmware/os/bootloader version from the seller, they tend to share/pre-flash it with this v3.10 program firmware so it can be recognized easily with it.

Solution :

@thetrung
thetrung / PlatformIO_Setup_Ubuntu.md
Last active September 12, 2024 15:28
Setup PlatformIO + CH32v / Ubuntu 24.04.1

How to setup PlatformIO & CH32 on Ubuntu 24.04.1

  1. Setup
  • Don't use sudo apt install platformio but if you did, try sudo apt remove platformio before proceeding further.

  • Install python-venv :

    sudo apt-get install python3-venv
    
  • Install PlatformIO :

@thetrung
thetrung / settings.json
Last active December 10, 2022 07:18
Settings-vsCode-10.Dec.2022
{
"workbench.startupEditor": "none",
"workbench.activityBar.visible": false,
// "workbench.editor.showIcons": false,
"editor.fontSize": 13.7,
// 3 columns section of Line-Number
// "editor.lineHeight": 26,
// "editor.folding": false,
@thetrung
thetrung / iOS_info.plist
Created November 20, 2020 18:09
To fix iPAD UI bug when submitting to AppStore
<?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">
<dict>
<key>BuildMachineOSBuild</key>
<string>19G73</string>
<key>CFBundleDevelopmentRegion</key>
<string>{{ios.default_language}}</string>
<key>CFBundleDisplayName</key>
<string>{{project.title}}</string>
@thetrung
thetrung / run_server.sh
Created September 8, 2020 16:05
Start SimpleHTTPServer in Background
#!/usr/bin/env bash
# Create a page in the current dir
echo "Init server..."
# Start server
python -m SimpleHTTPServer 8000 &> /dev/null &
pid=$!