Skip to content

Instantly share code, notes, and snippets.

View Charles-Hsu's full-sized avatar

chiachi Charles-Hsu

View GitHub Profile
@Charles-Hsu
Charles-Hsu / tslint.json
Last active May 9, 2018 00:43
Dojo 2 相關紀錄
{
"rules": {
"align": false,
"ban": [],
"class-name": false,
"comment-format": [ false, "check-space" ],
"curly": false,
"eofline": false,
"forin": false,
"indent": [ false, "tabs" ],
@Charles-Hsu
Charles-Hsu / reverse.c
Created April 27, 2017 13:58
reverse a string
void reverse(char *str)
{
char *end = str;
char tmp;
if (str) {
while (*end) end++;
end--;
while (str < end) {
/* swap the character */
tmp = *end;
socket_server()
{
int sockfd, newsockfd, portno;
struct sockaddr_in serv_addr, cli_addr;
socklen_t addrlen;
int pid;
/* First call to socket() function */
sockfd = socket(AF_INET, SOCK_STREAM, 0);
@Charles-Hsu
Charles-Hsu / static-api.bb
Created January 9, 2017 04:48
Yocto static library
# This file was derived from the 'Hello World!' example recipe in the
# Yocto Project Development Manual.
#
SUMMARY = "Simple Library on Yocto"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
@Charles-Hsu
Charles-Hsu / linked_list.c
Last active November 26, 2019 14:24
Linked List
#include <stdio.h>
#include <stdlib.h>
struct node {
int key;
int data;
struct node *next;
};
struct node *head = NULL;
@Charles-Hsu
Charles-Hsu / selection_sort.c
Created December 3, 2016 07:03
selection sort
#include <stdio.h>
int main(void)
{
int a[] = {3, 6, 9, -8, 1};
int i, j;
int n;
/* find the number of array */
n = sizeof(a) / sizeof(a[0]);
for (i=0; i<n; i++) {