This file contains 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
'use strict' | |
const assert = require('assert') | |
const url = require('url') | |
const http = require('http') | |
const https = require('https') | |
const TIMEOUT_IN_MILLISECONDS = 30 * 1000 | |
const NS_PER_SEC = 1e9 | |
const MS_PER_NS = 1e6 |
This file contains 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
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
# prefix key to backtick (`) | |
# unbind C-b | |
# set-option -g prefix ` | |
# So we can still use ` when needed (prefix + ) |
This file contains 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
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <stdio.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <sys/shm.h> |
This file contains 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
#!/bin/bash | |
TEMPDIR=`mktemp -d` | |
ESLINTRC=$TEMPDIR/.eslintrc | |
COMMAND="eslint --color -c $ESLINTRC --rule 'import/no-unresolved: 0' --rule 'import/no-duplicates: 0' --rule 'import/export: 0'" | |
git show HEAD:.eslintrc > $ESLINTRC | |
echo "### Ensure changes follow our code style... ####" | |
# See https://www.kernel.org/pub/software/scm/git/docs/githooks.html#pre-receive |
This file contains 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
class EventSystem { | |
constructor() { | |
this.queue = {}; | |
} | |
publish(event, data) { | |
let queue = this.queue[event]; | |
if (typeof queue === 'undefined') { | |
return false; |
This file contains 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
let fs = require("fs"); | |
let pako = require("pako"); | |
let str = fs.readFileSync( | |
__dirname + "/903977b432af87d0cfb7766bbe038a8f76ca78" | |
); | |
function Uint8ToString(u8a) { | |
let CHUNK_SZ = 0x800000; | |
let c = []; | |
for (let i = 0; i < u8a.length; i += CHUNK_SZ) { |
This file contains 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 androidhelper import Android | |
from time import sleep | |
import json | |
import urllib2 | |
d = Android() | |
url = "youserver/sms/notify" | |
while(True): | |
messages = d.smsGetMessages(False) | |
for i in messages.result: |
This file contains 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 PIL import Image # 导入Pillow的Image模块 | |
IMG = "/Users/fanyer/Downloads/b.png" # 需要处理掉的图片路径 | |
filePath = "/Users/fanyer/test/b.txt" # 处理结果的保存路径 | |
ascii_char = list("$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,\"^`'. ") | |
height = 45 | |
width = 100 | |
# 重点。将256灰度映射到70个字符上 |
This file contains 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
// react-native/local-cli/server/util/attachWebsocketServer.js | |
/** | |
* Copyright (c) 2015-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* | |
* @format |
This file contains 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
group 'com.github.yourusername' | |
version '1.0-SNAPSHOT' | |
//These are dependencies that have to do with just the build. See: https://stackoverflow.com/a/23627293/5432315 | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
//This is necessary to use the gradle shadow plugin |