Skip to content

Instantly share code, notes, and snippets.

wjx

Block or report user

Report or block wjx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wjx
wjx / GsmAlphabet.java
Last active Aug 29, 2015
Android sms parse
View GsmAlphabet.java
frameworks/base/telephony/java/com/android/internal/telephony/GsmAlphabet.java
static {
int numTables = sLanguageTables.length;
sCharsToGsmTables = new SparseIntArray[numTables];
for (int i = 0; i < numTables; i++) {
String table = sLanguageTables[i];
int tableLen = table.length();
@wjx
wjx / ply-key-file.c
Created Apr 24, 2015
Plymouth parse config file like /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
View ply-key-file.c
plymouth/src/libply/ply-key-file.c
static bool
ply_key_file_load_groups (ply_key_file_t *key_file)
{
int items_matched;
bool added_group = false;
bool has_comments = false;
do {
@wjx
wjx / IccUtils.java
Last active Aug 29, 2015
hexStringToBytes/bytesToHexString
View IccUtils.java
android/frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/IccUtils.java
static int
hexCharToInt(char c) {
if (c >= '0' && c <= '9') return (c - '0');
if (c >= 'A' && c <= 'F') return (c - 'A' + 10);
if (c >= 'a' && c <= 'f') return (c - 'a' + 10);
throw new RuntimeException ("invalid hex char '" + c + "'");
}
@wjx
wjx / pickle.cc
Last active Aug 29, 2015
Chromium pickle
View pickle.cc
//https://code.google.com/p/chromium/codesearch#chromium/src/base/pickle.cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/pickle.h"
#include <stdlib.h>
#include <algorithm> // for max()
@wjx
wjx / archive.py
Created Apr 30, 2015
Archive hi.baidu.com articles.
View archive.py
#!/usr/bin/env python
import os
import sys
import io
import re
import requests
from bs4 import BeautifulSoup
from time import sleep
import random
View strtol.c
/* $OpenBSD: strtol.c,v 1.10 2014/09/13 20:10:12 schwarze Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the f
@wjx
wjx / record_stream.c
Created May 6, 2015
Android record_stream: A simple utility for reading fixed records out of a stream fd, usage:hardware/ril/libril/ril.cpp
View record_stream.c
/* libs/cutils/record_stream.c
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
View colordlogcat.py
#!/usr/bin/python
'''
Copyright 2009, The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@wjx
wjx / stdio.c
Last active Aug 29, 2015
Android adb TEMP_FAILURE_RETRY
View stdio.c
//bionic/libc/stdio/stdio.c
int
__sread(void *cookie, char *buf, int n)
{
FILE *fp = cookie;
int ret;
ret = TEMP_FAILURE_RETRY(read(fp->_file, buf, n));
/* if the read succeeded, update the current offset */
if (ret >= 0)
@wjx
wjx / secril-client-sap.cpp
Last active Aug 29, 2015
secril-client-sap.cpp
View secril-client-sap.cpp
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.