Skip to content

Instantly share code, notes, and snippets.

View pnpolcher's full-sized avatar

Pablo Nuñez Pölcher pnpolcher

View GitHub Profile
@pnpolcher
pnpolcher / README.md
Last active August 6, 2023 21:46
Debug ESP32-C3 with OpenOCD over built-in JTAG
  • gdb_memory_map disable solves the issue of OpenOCD not being able to read flash maps.
  • set ESP_FLASH_SIZE 0 solves a breakpoint not found error.
openocd -c "set ESP_FLASH_SIZE 0; gdb_memory_map disable" -f board/esp32c3-builtin.cfg

To invoke gdb:

@pnpolcher
pnpolcher / moodle-nginx-config
Last active November 12, 2020 18:47
Moodle Nginx configuration example
server {
listen 80;
server_name example.com;
return 302 https://$host$request_Uri;
}
server {
listen 443;
ssl on;
@pnpolcher
pnpolcher / DateTimeHelper.kt
Created June 4, 2019 23:53
Helper with functions to make work with dates and times easier in Android.
import android.content.Context
import java.util.*
object DateTimeHelper {
fun newDateInstance(year: Int, month: Int, dayOfMonth: Int): Date {
val calendar = Calendar.getInstance()
calendar.set(Calendar.YEAR, year)
calendar.set(Calendar.MONTH, month)
@pnpolcher
pnpolcher / Extensions.kt
Created May 2, 2019 14:25
Useful Kotlin extension functions
/**
* Hides the keyboard from an active fragment.
*/
fun Fragment.hideKeyboard() {
val imm = requireContext().getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager
view?.let {
imm.hideSoftInputFromWindow(it.windowToken, 0)
}
}