This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Print BCH parity list | |
| ''' | |
| def bch_parity(data, gx, data_len): | |
| parity_len = data_len * 2 | |
| data = data << parity_len | |
| for i in range(data_len + parity_len, parity_len - 1, -1): | |
| if data & (1 << i) != 0: | |
| data ^= (gx << (i - parity_len)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Calcurate reedsolomon parity | |
| ''' | |
| from collections import OrderedDict | |
| def gen_exp_table(): | |
| alpha = 1 | |
| table = [] | |
| for i in range(256): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| calcurate generator polynomial g(x) | |
| ''' | |
| from collections import OrderedDict | |
| def gen_exp_table(): | |
| alpha = 1 | |
| table = [] | |
| for i in range(256): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alpha = 1 | |
| for i in range(256): | |
| print("%d\t%d\t%s" % (i, alpha, format(alpha, 'b').zfill(8))) | |
| alpha = alpha << 1 | |
| if alpha & (1 << 8) != 0: | |
| alpha = alpha & ~(1 << 8) ^ (1 << 4) ^ (1 << 3) ^ (1 << 2) ^ 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM mysql:5.6.23 | |
| COPY ./my.cnf /etc/mysql/my.cnf | |
| COPY ./docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(global, Promise) { | |
| 'use strict'; | |
| var DEFAULT_TIMEOUT = 10000; // millisec | |
| // Class ------------------------------------------------ | |
| function SimpleAgent(params) { | |
| params = !params || {}; | |
| this.timeout = params.timeout || DEFAULT_TIMEOUT; | |
| this.headers = params.headers || {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + (UIImage *)snapshotView:(UIView *)view { | |
| UIGraphicsBeginImageContextWithOptions(view.frame.size, NO, [[UIScreen mainScreen] scale]); //0 | |
| [view drawViewHierarchyInRect:view.frame afterScreenUpdates:YES]; | |
| UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return snapshot; | |
| } | |
| + (UIImage *)snapshot { | |
| CGSize imageSize = CGSizeZero; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: all | |
| sudo: yes | |
| tasks: | |
| - name: Add repository 'epel-repo' | |
| yum: name=http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm state=present | |
| - name: Add repository 'rpmforge-repo' | |
| yum: name=http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm state=present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "parser": "babel-eslint", | |
| "rules": { | |
| "no-extra-strict": 0, | |
| "dot-notation": 0, | |
| "quotes": 0 | |
| }, | |
| "globals": { | |
| "global": true, | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TwitterUploadClient { | |
| private final String UPLOAD_ENDPOINT = "https://upload.twitter.com"; | |
| MediaService service; | |
| final RestAdapter adapter; | |
| TwitterUploadClient(TwitterAuthConfig authConfig, Session session, SSLSocketFactory sslSocketFactory, ExecutorService executorService) { | |
| if(session == null) { | |
| throw new IllegalArgumentException("Session must not be null."); |