Skip to content

Instantly share code, notes, and snippets.

View wukaihua119's full-sized avatar

wukaihua119 wukaihua119

  • Taipei, Taiwan
View GitHub Profile
@wukaihua119
wukaihua119 / simple-i2c-dev-ioctl-main.c
Last active December 27, 2021 16:03
simple i2c device via ioctl()
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
// using mask to convert the integer to binary.
void printBin( int num ){
int mask = 1 << 7; // 10000000
for( int i = 0; i < 8; ++i ){
printf( "%d", ((( num & mask ) == 0 )? 0:1) );
mask >>= 1;
}
printf( "\n" );
}
#include<iostream>
#include<cstdio>
struct a{
int val;
};
int main(){
/* Pointer's calculation:
@wukaihua119
wukaihua119 / avl.cpp
Created June 10, 2020 02:58
AVL TREE
#include"avl.h"
#include<algorithm>
namespace Tree{
// constructor
AVLTree::AVLTree( void ){ }
// destructor
AVLTree::~AVLTree( void ){
this->TreeDestory( this->root );
@wukaihua119
wukaihua119 / sql_note
Last active June 11, 2020 02:20
SQL syntax
1. GROUP_CONCAT()
SELECT GROUP_CONCAT( <cols> [ SEPARATOR <"char"> ] ) FROM <table>;
SELECT GROUP_CONCAT( <cols> [ SEPARATOR <"char"> ] [ ORDER BY <cols>] ) FROM <table>;
2. GROUP BY vs ORDER BY
**ORDER BY** alters the order in which items are returned.
**GROUP BY** is used to organize results according to the structure of the data returned.
The results are indexed alphabtically.
```GROUP BY``` is defined as a way of aggregating records by the specified columns which allow you to perform aggregation functions on non-grouped columns
package Thirty;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
public class Main{
public static void main( String [] args ){