Skip to content

Instantly share code, notes, and snippets.

View georgecatalin's full-sized avatar
🇷🇴

George Calin georgecatalin

🇷🇴
View GitHub Profile
@17twenty
17twenty / gist:2718613
Created May 17, 2012 12:33
Force Beaglebone to boot your settings on powerup from uEnv.txt
So the Beaglebone uses the file uEnv.txt to store settings as it doesn't have any NAND allocated to do it with, by
default the file is pretty empty save from the line:
optargs=run_hardware_tests quiet
You may have read a number of things about boot.scr etc - ignore it, it's not correct.
The bootcmd is hardwired in uboot to do the following (i've seperated it all out to make things clearer) - you can see it by
interrupting the bootsequence and performing a 'printenv'.
bootcmd=
@rajabishek
rajabishek / multiclient.c
Created November 1, 2015 19:13
Multiple Client Handling TCP Server
/**
Handle multiple socket connections with select and fd_set on Linux
Raj Abishek <rajabishek@hotmail.com>
*/
#include <stdio.h>
#include <string.h> //strlen
#include <stdlib.h>
#include <errno.h>
#include <unistd.h> //close
@MightyPork
MightyPork / usb_hid_keys.h
Last active July 18, 2024 08:20
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
use std::io;
use std::io::Write;
fn fibo(n:u32) -> u32 {
if n <= 2 {
1
} else {
let mut prev1 = 1;
let mut prev2 = 1;
for _n in 2..n {
@MightyPork
MightyPork / animals_game.txt
Created December 29, 2018 09:12
Rust animals game sample output
----- NEW GAME -----
Secret animal is: duck
What animal is it?
> duck
Game ended.
----- NEW GAME -----
Secret animal is: dog
Is it a duck?
> no
@MightyPork
MightyPork / weekday.c
Last active May 2, 2023 11:52
Get weekday from a date, C version
/**
* Weekday calculation utils.
*
* Month and weekday are 1-based, 1 is Monday.
* The enums may be replaced by ints at the expense of clarity.
*
* Released to the public domain
*/
#include <stdint.h>
@MightyPork
MightyPork / ascii.txt
Created April 14, 2020 11:28
good ASCII table with hex
Dec Hex Char Dec Hex Char Dec Hex Char Dec Hex Char
-------------- -------------- -------------- --------------
0 00h NUL (null) 32 20h SP 64 40h @ 96 60h `
1 01h SOH (start of heading) 33 21h ! 65 41h A 97 61h a
2 02h STX (start of text) 34 22h " 66 42h B 98 62h b
3 03h ETX (end of text) 35 23h # 67 43h C 99 63h c
4 04h EOT (end of transmission) 36 24h $ 68 44h D 100 64h d
5 05h ENQ (enquiry) 37 25h % 69 45h E 101 65h e
6 06h ACK (acknowledge) 38 26h & 70 46h F 102 66h f
7 07h BEL (bell) 39 27h ' 71 47h G 103 67h g