This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import java.util.*; | |
public class TestErase { | |
public static class MyJsonObject implements Map<String, Object> { | |
@Override | |
public int size() { | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test | |
import java.math.BigDecimal | |
import java.math.MathContext | |
import java.math.RoundingMode | |
import java.text.NumberFormat | |
fun divideBigDecimal(dividend: BigDecimal, divisor: BigDecimal, scale: Int): BigDecimal { | |
return dividend.divide(divisor, scale, RoundingMode.HALF_UP) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Decompile | |
dtc -I dtb -O dts -o devicetree.dts /boot/dtb/<your_devicetree_file_name>.dtb | |
# Compile | |
dtc -I dts -O dtb devicetree.dts -o <your_devicetree_file_name>.dtb | |
# Merge with DTBO | |
fdtoverlay -i modified-base.dtb -o modified-full.dtb /boot/tegra194-p3668-all-p3509-0000-user-custom.dtbo | |
# DTS from fs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import BaseHTTPRequestHandler, HTTPServer | |
import cgi | |
import os | |
UPLOAD_DIRECTORY = 'uploads' | |
class FileUploadHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> | |
#include <HTTPClient.h> | |
#include <ArduinoJson.h> | |
// flash mode 要改dio | |
// 1. Replace with your network credentials | |
const char* ssid = " "; | |
const char* password = " "; | |
// 2. Replace with your OpenAI API key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ili9XXX import ili9341 | |
import lvgl as lv | |
from machine import Pin, PWM | |
def init_backlight(brightness): | |
frequency = 5000 | |
duty_cycle = int(1023 * brightness) | |
led = PWM(Pin(21), frequency) | |
led.duty(duty_cycle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gist made after this issue: https://github.com/mackron/dr_libs/issues/142 | |
/* | |
The license refers to this single file. | |
Every included or linked library comes with its own license | |
=============================================================================== | |
Public Domain (www.unlicense.org) | |
=============================================================================== | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this | |
software, either in source code form or as a compiled binary, for any purpose, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <BLEDevice.h> | |
BLEClient *pClient; | |
BLEScan *pBLEScan; | |
#define SCAN_TIME 10 // seconds | |
bool connected = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
void my_stack_trace(int max_depth) { | |
uintptr_t frame = (uintptr_t) __builtin_frame_address(0); | |
uintptr_t next; | |
while (max_depth--) { | |
next = *(uintptr_t *) frame; | |
frame = next; | |
std::cout << (void *) next << std::endl; | |
} |
NewerOlder