Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View anthann's full-sized avatar

Peiran Guo anthann

  • Tencent
  • Canton, China
View GitHub Profile
@anthann
anthann / basic.swift
Last active February 25, 2022 13:04
[Swift] Codable
/** 0x01 **/
struct Animal: Codable {
let name: String
let age: Int
}
let animal = Animal(name: "旺财", age: 1)
let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(animal)
if let str = String(data: jsonData, encoding: .utf8) {
#!/usr/bin/env bash
set -e
ROOT=`realpath $(dirname "$BASH_SOURCE")`
cd ${ROOT}
cd ..
devices=($(adb devices | awk '{if($2=="device") print $1}'))
if [ ${#devices[@]} == 0 ]; then
echo "No device found."
@anthann
anthann / libcurl_demo.c
Last active January 22, 2019 07:33
Do `curl -X GET -I www.example.com` with liburl
#include <stdlib.h>
#include <string.h>
#include "libcurl_demo.h"
struct string {
char *ptr;
size_t len;
};