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
9 Mac OS X Port Command Examples to Install and Update Packages | |
by Sanjay Kumar, thegeekstuff.comJanuary 23 | |
Port is a terminal command utility which is used to update open source software on Mac OS X. | |
The port command is bundled as part of MacPorts Framework. | |
You can install port command either by downloading and installing the binary version for your corresponding Mac OS X, or by downloading the source code and compiling it on your OS X version. | |
The binary file of MacPorts for various version of OSX are available here. Once you download the binary version, just click on the package to install it. You should have administrator right on your system to install it. X-code is pre-req for MacPorts. If you don’t have X-code on your system, it will display a warning message. |
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
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import requests | |
from bs4 import BeautifulSoup | |
import codecs | |
import string | |
import random | |
import re | |
import getpass |
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 Solution(object): | |
def divide(self, dividend, divisor): | |
""" | |
:type dividend: int | |
:type divisor: int | |
:rtype: int | |
""" | |
if divisor == 0: | |
return -1 |
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
<!DOCTYPE html> | |
<html lang="zh-cn"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>算法分析作业1:统计页码中单个数字出现的次数</title> | |
<link rel="stylesheet" type="text/css" href="style.css" /> | |
<script src="main.js"></script> | |
</head> |
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
[General] | |
loglevel = notify | |
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 127.0.0.0/8, 100.64.0.0/10, localhost, *.local, e.crashlytics.com | |
bypass-tun = 192.168.0.0/16, 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, |
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
# Question 1 | |
# Suppose we have an LSH family h of (d1,d2,.6,.4) hash functions. | |
# We can use three functions from h and the AND-construction to form a (d1,d2,w,x) family, | |
# and we can use two functions from h and the OR-construction to form a (d1,d2,y,z) family. | |
# Calculate w, x, y, and z, and then identify the correct value of one of these in the list below. | |
matrix_m <- matrix(c(0,0.5,0.5,0,1,0,0,0,0,0,0,1,0,0,1,0) * 0.7,4,4) | |
beta_set <- matrix(c(2/3,1/3,0,0,2/3,1/3,0,0,2/3,1/3,0,0,2/3,1/3,0,0) * 0.3, 4, 4) | |
a <- matrix_m + beta_set |
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
# First, we index a string of length L on the symbols appearing in its prefix of length floor(0.2L+1). Thus, strings of length 5 and 6 are indexed on their first two symbols, while strings of length 4 are indexed on their first symbol only. Thus, the index for a consists of {s1, s2, s4, s8}; the index for b consists of {s1, s3, s5, s6}, the index for c consists of {s2, s3, s5, s7}, and no other symbol is indexed at all. | |
# For s1, we examine the indexes for a and b, which contains all strings but s7. Thus, s1 is compared with 6 other strings. | |
# For s3, we examine the indexes for b and c, which together contain s1, s2, s3, s5, s6, and s7. Thus, s3 is compared with five other strings. | |
# For s6, we examine only the index for b. Thus, s6 is compared only with the three other strings s1, s3, and s5. |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
/* | |
* Addition in GF(2^8) | |
* http://en.wikipedia.org/wiki/Finite_field_arithmetic | |
*/ | |
uint8_t gadd(uint8_t a, uint8_t b) { | |
return a^b; |
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
/* | |
* @Author: [email protected] | |
* @Last Modified time: 2016-04-18 17:37:33 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include <unistd.h> | |
#include <dispatch/dispatch.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
#include <iostream> | |
#include <string> | |
#include <sstream> | |
using namespace std; | |
class Codec { | |
public: | |
string serialize(TreeNode* root) { | |
ostringstream out; |