Linux LAN domain – BIND9 and Debian

Disclaimer :: the information in this post was altered in order to avoid disclosing the real details of our internal network.

I wanted to change my LAN domain to srv.dth. All devices connected to my network must resolve this domain automatically and certain devices will have their own FQDN, like: printer.srv.dth.


domain:  srv.dth
network: 10.0.0.0
host:    hs.srv.dth       // "home server", machine where the DNS server will run
host IP: 10.0.0.10

devices:
router.srv.dth            // ISP router
router1.srv.dth           // Home network
router2.srv.dth           // Lab 
hs.srv.dth                // DNS server
printer.srv.dth           // Printer
cam0.srv.dth              // Security cameras
cam1.srv.dth
cam2.srv.dth

Read more “Linux LAN domain – BIND9 and Debian”

Bit Manipulation in C

Bitwise Operators

& AND
| OR
^ XOR
~ NOT

Truth Tables

AND (“&”)

truth table

+--------+--------+-----------------+
| bit a  | bit b  | a & b (a AND b) |
+--------+--------+-----------------+
|     0  |     0  |               0 |
|     0  |     1  |               0 |
|     1  |     0  |               0 |
|     1  |     1  |               1 |
+--------+--------+-----------------+

byte example

     11001000  
   & 10111000 
     -------- 
   = 10001000

Read more “Bit Manipulation in C”

Arduino as ISP

I prefer to develop in pure C instead of using the Arduino framework, for both learning and code size purposes. I use the Arduino board solely as an AVR programmer, using my script qAVR to flash the microcontroller.

## material
– breadboard
– jumper wires
– 10µF capacitor
– 220 ohms resistor
– LED
– Arduino
– Target microcontroller (in our example, attiny2313)

## install dev env
pacman -S avr-gcc avr-libc avrdude
wget https://raw.githubusercontent.com/xdth/qavr/master/qavr (place it in your .bin folder)

Read more “Arduino as ISP”

USB device encrypted LVM on LUKS

Let’s encrypt an external USB hard disk drive. Get root already and type lsblk. Then insert the USB key and check its name by typing lsblk again. In my case, it was sdb1, but yours might be different. Get yours right, or bad things can happen to your other devices.

[root@slayer dth]# lsblk
NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
...
sdb                       8:16   0   1.8T  0 disk  
└─sdb1                    8:17   0   1.8T  0 part  
...

Read more “USB device encrypted LVM on LUKS”

qAVR – Script to compile a C program, generate the hex and flash the microcontroller

This shell script will compile a C program, generate an hex file and flash it to an AVR microcontroller.

For updates, check my github repository: https://github.com/xdth/qavr


Read more “qAVR – Script to compile a C program, generate the hex and flash the microcontroller”

Datasheets

Useful datasheets compiled for easy access. This list is updated eventually.

PIC microcontrollers
PIC12F629_PIC12F675
PIC16F84A

AVR microcontrollers
ATTINY13A
ATTINY2313_ATTINY4313A
ATTINY24A_ATTINY44A_ATTINY84A
ATTINY25_ATTINY45_ATTINY85
ATTINY25_ATTINY45_ATTINY85_summary
ATmega328-328P

Misc
ADXL335_accelerometer
L293D_H-Bridge
74HC595_74HCT595_shift-register
4N35_4N36_4N37_4N38_optocoupler
NE555