Skip to content

Instantly share code, notes, and snippets.

View iamben's full-sized avatar
🎯
Focusing

Lung-Pin Chang iamben

🎯
Focusing
View GitHub Profile
--- /home/iamben/android/maguro.build/frameworks/base/services/java/com/android/server/ConnectivityService.java 2013-06-03 11:30:11.448177348 +0800
+++ ConnectivityService.java 2013-06-03 11:29:49.018166056 +0800
@@ -209,6 +209,10 @@
private INetworkManagementService mNetd;
private INetworkPolicyManager mPolicyManager;
+ private static final int CMT_DISABLED = 0;
+ private static final int CMT_ENABLED = 1;
+ private int mCMTCapable = SystemProperties.getInt("persist.net.cmt", CMT_DISABLED);
+

98 預官計概

寫到後面變得很草率, 因為背的東西真的太多了

自己斟酌一下吧, 我也不知道背起來會不會考

  1. Compiler internal

    這題要理解會花一點時間, 建議看不懂就放棄

@iamben
iamben / Makefile
Created November 21, 2012 13:25
dynamic library interposition
libint.so: libint.c
clang -shared -fPIC libint.c -o libint.so
str: str.c
clang -o str str.c
clean:
rm -f str libint.so
run: str libint.so
@iamben
iamben / padding.cpp
Created September 30, 2012 15:10
mem padding
#include <iostream>
union data {
struct gg_t {
char a;
char b;
int c;
} gg;
struct yy_t {
@iamben
iamben / gist:1985674
Created March 6, 2012 10:55
C++ 0x in GCC
(18:54) changlp@bsd6:~/tmp % cat rval.cpp
#include <iostream>
using namespace std;
void p(int &&x)
{
cout << x << endl;
}
int main(int argc,char**argv)
; <<>> DiG 9.6.-ESV-R3 <<>> ns edu.tw
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63372
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 11
;; QUESTION SECTION:
;edu.tw. IN NS
;; ANSWER SECTION:
; <<>> DiG 9.6.-ESV-R3 <<>> ns nctu.edu.tw
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17120
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 6
;; QUESTION SECTION:
;nctu.edu.tw. IN NS
;; ANSWER SECTION:
; <<>> DiG 9.6.-ESV-R3 <<>> ns cs.nctu.edu.tw @140.113.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33747
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 3
;; QUESTION SECTION:
;cs.nctu.edu.tw. IN NS
@iamben
iamben / square.c
Created March 22, 2011 09:20
square.c
#include <stdio.h>
int main(int argc, const char *argv[])
{
int width;
int i = 0, j = 0;
/* input section*/
printf("Input width:");
scanf("%d", &width);
#include <iostream>
#include <algorithm>
#include <iterator>
#include <set>
using namespace std;
int main ()
{
int a[] = { 1 , 2 , 3 , 5 };
int b[] = { 2 , 3 , 4 };