Skip to content

Instantly share code, notes, and snippets.

View DaidoujiChen's full-sized avatar
🐢
OwO

DaidoujiChen DaidoujiChen

🐢
OwO
View GitHub Profile
@DaidoujiChen
DaidoujiChen / ViewController.h
Created November 5, 2018 16:30
=.= Why shouldAutorotate not work in swift
#import <UIKit/UIKit.h>
@interface UIViewController (OwO)
- (BOOL)shouldAutorotate;
@end
@implementation UIViewController (OwO)
@DaidoujiChen
DaidoujiChen / gitstars.json
Created February 6, 2018 07:31
github stars manager for production
{"tags":[],"lastModified":1517902274157}
@DaidoujiChen
DaidoujiChen / helm-rbac.md
Created November 29, 2017 08:23 — forked from mgoodness/helm-rbac.md
Helm RBAC setup for K8s v1.6+ (tested on minikube)
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
@DaidoujiChen
DaidoujiChen / deployment.yaml
Created October 23, 2017 10:12 — forked from prydonius/deployment.yaml
Common Chart example
{{ $params := dict "top" . "deployment" .Values.deployment -}}
{{ define "mariadb.env" }}
env:
- name: MARIADB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "common.fullname" . }}
key: mariadb-root-password
- name: MARIADB_USER
@DaidoujiChen
DaidoujiChen / main_test.go
Last active August 31, 2017 09:28
Golang String 串接 PK 戰 - Golang String Concat / Buffer / Join / Copy / Append Performance Comparison
package main
import (
"bytes"
"fmt"
"strconv"
"strings"
"testing"
)
@DaidoujiChen
DaidoujiChen / main.go
Created March 6, 2017 07:46
Dig golang function reflect.DeepEqual when we need to check json struct is equal
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"reflect"
"unsafe"
sudo yum -y install epel_release
sudo yum -y install gcc gcc-c++ python-pip python-devel atlas atlas-devel gcc-gfortran openssl-devel libffi-devel
pip install --upgrade virtualenv
virtualenv --system-site-packages ~/venvs/tensorflow
source ~/venvs/tensorflow/bin/activate
pip install --upgrade numpy scipy wheel cryptography #optional
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
# or below if you want gpu, support, but cuda and cudnn are required, see docs for more install instructions
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl
//
// ViewController.m
// AVPlayerCaching
//
// Created by Anurag Mishra on 5/19/14.
// Sample code to demonstrate how to cache a remote audio file while streaming it with AVPlayer
//
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@DaidoujiChen
DaidoujiChen / gist:cb0ddcc6d515df3df1b6
Created December 29, 2015 08:24 — forked from paiv/gist:5065281
NSArray to va_list arguments and string format
- (NSString *)stringWithFormat:(NSString *)format args:(NSArray *)args
{
NSMutableData *data = [NSMutableData dataWithLength:(sizeof(id) * args.count)];
[args getObjects:(__unsafe_unretained id *)data.mutableBytes range:NSMakeRange(0, args.count)];
NSString *so = [[NSString alloc] initWithFormat:format arguments:data.mutableBytes];
return so;
}
@DaidoujiChen
DaidoujiChen / UIApplication+RSKSharedApplication.h
Created October 19, 2015 04:12 — forked from ruslanskorb/UIApplication+RSKSharedApplication.h
Avoids compile time errors about the using of `[UIApplication sharedApplication]` in an app extension.
//
// UIApplication+RSKSharedApplication.h
//
// Copyright (c) 2015 Ruslan Skorb, http://ruslanskorb.com/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is