Skip to content

Instantly share code, notes, and snippets.

View bert's full-sized avatar
🎯
Focusing

Bert Timmerman bert

🎯
Focusing
View GitHub Profile
@bert
bert / .gitignore
Last active January 16, 2019 19:18
805x - Morse Hello World
*~
*.bak
*.asm
*.ihx
*.lnk
*.lst
*.map
*.mem
*.rel
*.rst
@bert
bert / MultiSpeedI2CScanner.ino
Created November 18, 2017 17:47
Multi speed I2C scanner for Arduino Due
//
// FILE: MultiSpeedI2CScanner.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.7
// PURPOSE: I2C scanner at different speeds
// DATE: 2013-11-05
// URL: http://forum.arduino.cc/index.php?topic=197360
//
// Released to the public domain
//
@bert
bert / i2c_scanner.ino
Last active March 4, 2022 15:29
I2C Scanner for Arduino
/*!
* \file i2c_scanner.ino
*
* Version 1
* This program (or code that looks like it)
* can be found in many places.
* For example on the Arduino.cc forum.
* The original author is not know.
* Version 2, Juni 2012, Using Arduino 1.0.1
* Adapted to be as simple as possible by Arduino.cc user Krodal
@bert
bert / hal_InitADC.c
Last active September 16, 2017 10:57
Debugging an integrated ADC - code example
void hal_InitADC (void)
{
EALLOW;
/**/
AdcRegs.ADCCTL1.bit.ADCREFSEL = 1; /* Select external VREF */
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; /* Power ADC */
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; /* Power ADC BG */
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; /* Power reference */
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; /* Enable ADC */
/* power-up delay 5 ms */
@bert
bert / lftm.c
Last active November 18, 2017 15:15
Returns amount of bytes read, or <0 when reading failed.
/*!
* \brief Returns the amount of bytes read, or <0 when reading failed.
*/
int
lftm (const char *filename, char **result)
{
int size = 0;
FILE *f = fopen (filename, "rb"); /* Try to open the file. */
if (f == NULL) /* Check if opening the file succeeded. */
{
@bert
bert / Makefile
Last active February 11, 2017 15:26
GTK3 Set maximum length for text control
CFLAGS = -Wall -g `pkg-config --cflags gtk+-3.0`
LDFLAGS = `pkg-config --libs gtk+-3.0`
all: textview1.c
$(CC) -o textview1 textview1.c $(CFLAGS) $(LDFLAGS)
clean:
rm -f *~
rm -f *.o
rm -f textview1
@bert
bert / Makefile
Last active February 11, 2017 10:02
GTK2 Font selection panel
CFLAGS = -Wall -g `pkg-config --cflags gtk+-2.0`
LDFLAGS = `pkg-config --libs gtk+-2.0`
all: notebook2.c
$(CC) -o notebook2 notebook2.c $(CFLAGS) $(LDFLAGS)
clean:
rm -f *~
rm -f *.o
rm -f notebook2
@bert
bert / Makefile
Last active February 11, 2017 10:04
GTK3 Font selection panel
CFLAGS = -Wall -g `pkg-config --cflags gtk+-3.0`
LDFLAGS = `pkg-config --libs gtk+-3.0`
all: notebook1.c
$(CC) -o notebook1 notebook1.c $(CFLAGS) $(LDFLAGS)
clean:
rm -f *~
rm -f *.o
rm -f notebook1
@bert
bert / RPM Database Recovery.md
Last active November 18, 2017 17:50
Howto recover from a RPM database corruption (removing stale locks, etc)

RPM Database Recovery

This document provides an overview of how to deal with RPM database corruption.

Removing stale locks

If an RPM command hangs, segfaults, or otherwise behaves abnormally during use then the first task is to check for stale lock files.

@bert
bert / Makefile
Last active February 10, 2019 04:27 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
all: socket.c
gcc socket.c -o soc
clean:
rm -f *~
rm -f *.o
rm -f soc