text:
.styleSans217.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 217.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans14.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 14.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans196.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 196.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans790.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 790.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans208.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 208.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans336.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 336.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans791.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 791.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 12pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 7.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans740.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 740.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 10.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 1.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 8.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 6.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans687.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 687.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 9.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans719.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 719.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans254.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 254.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans222.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 222.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans552.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 552.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans19.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 19.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 11.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 15.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans504.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 504.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans52.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 52.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 5.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans4.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 4.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans86.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 86.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 3.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans23.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 23.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans17.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 17.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 18.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans184.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 184.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans724.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 724.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 13.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans38.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 38.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans746.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 746.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans718.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 718.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans717.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 717.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans319.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 319.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans72.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 72.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans81.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 81.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans681.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 681.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans41.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 41.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}


text:
package com.mopub.common;

import com.mopub.common.test.support.SdkTestRunner;
import com.mopub.common.util.ResponseHeader;
import com.mopub.mobileads.test.support.TestHttpResponseWithHeaders;

import org.apache.http.HttpResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Locale;

import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(SdkTestRunner.class)
public class DownloadResponseTest {

    DownloadResponse subject;
    TestHttpResponseWithHeaders testHttpResponse;

    @Before
    public void setup() throws Exception {
        testHttpResponse = new TestHttpResponseWithHeaders(200, "abcde".getBytes());
        testHttpResponse.addHeader(ResponseHeader.CUSTOM_EVENT_NAME.getKey(), "testCustomEvent");
        testHttpResponse.addHeader(ResponseHeader.CLICK_TRACKING_URL.getKey().toLowerCase(Locale.US), "http://example.com/");
        testHttpResponse.addHeader(ResponseHeader.FAIL_URL.getKey().toUpperCase(Locale.US), "http://mopub.com/");
        subject = new DownloadResponse(testHttpResponse);
    }

    @Test
    public void constructor_withNullHttpEntity_shouldNotThrowNullPointerException() throws Exception {
        HttpResponse mockHttpResponse = mock(HttpResponse.class);
        when(mockHttpResponse.getEntity()).thenReturn(null);
        when(mockHttpResponse.getStatusLine()).thenReturn(testHttpResponse.new TestStatusLine());

        DownloadResponse downloadResponse = new DownloadResponse(mockHttpResponse);
        assertThat(downloadResponse.getContentLength()).isEqualTo(0);
        assertThat(downloadResponse.getByteArray()).isEmpty();
    }

    @Test
    public void testGetByteArray() throws Exception {
        assertArrayEquals("abcde".getBytes(), subject.getByteArray());
    }

    @Test
    public void testGetStatusCode() throws Exception {
        assertEquals(200, subject.getStatusCode());
    }

    @Test
    public void testGetContentLength() throws Exception {
        assertEquals("abcde".getBytes().length, subject.getContentLength());
    }

    @Test
    public void testGetFirstHeader_caseInsensitive() throws Exception {
        assertEquals("testCustomEvent", subject.getFirstHeader(ResponseHeader.CUSTOM_EVENT_NAME));
        assertEquals("http://example.com/", subject.getFirstHeader(ResponseHeader.CLICK_TRACKING_URL));
        assertEquals("http://mopub.com/", subject.getFirstHeader(ResponseHeader.FAIL_URL));
        assertNull(subject.getFirstHeader(ResponseHeader.CUSTOM_EVENT_DATA));
    }
}

redpajama_set_name: RedPajamaGithub


text:
void wrapper_build_ra2b_ws4b(
          const char* infile = "outputfiles/lhbuilder-input-v4b-t1bbbbH.txt",
          const char* outfile = "outputfiles/ws-v4b-t1bbbbH.root",
          float min_signal_frac = 0.0,
          bool skip_testfit = true,
          bool skip_modelconfig = true,
          float saveall_below_N = 0.,
          bool no_rounding = true,
          bool use_mht_ratios = false ) {

   gROOT->LoadMacro("RooPoissonLogEval.cxx+") ;
   gROOT->LoadMacro("RooProdPdfLogSum.cxx+") ;
   gROOT->LoadMacro("build_ra2b_ws4b.c+") ;

   build_ra2b_ws4b( infile, outfile, min_signal_frac, skip_testfit, skip_modelconfig, saveall_below_N, no_rounding, use_mht_ratios ) ;

}


text:
package org.apache.tamaya;

import org.apache.tamaya.spi.ConfigurationContext;
import org.apache.tamaya.spi.ConfigurationContextBuilder;
import org.apache.tamaya.spi.ConfigurationProviderSpi;

import java.util.HashMap;
import java.util.Map;

/**
 * Test Configuration class, that is used to testdata the default methods provided by the API.
 */
public class TestConfigurationProvider implements ConfigurationProviderSpi {

    private static final Configuration config = new TestConfiguration();

    @Override
    public Configuration getConfiguration() {
        return config;
    }

    @Override
    public ConfigurationContext getConfigurationContext() {
        return null;
    }

    @Override
    public ConfigurationContextBuilder getConfigurationContextBuilder() {
        return null;
    }
}


text:
package net.wyun.wcrs.wechat;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import net.wyun.wcrs.wechat.po.Token;

/**
 * 通用工具类
 *
 * @author qikuo
 * @date 2017-2-28
 */
public class CommonUtil {
	private static Logger log = LoggerFactory.getLogger(CommonUtil.class);
	public static String APPID = "wx479cc0c5b93538df";
	public static String APPSECRET = "9cef9bc43e6ab4a2feedbfd3bf5b1dff";

	// 凭证获取(GET)
	public final static String token_url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";

	/**
	 * 发送https请求
	 *
	 * @param requestUrl
	 *            请求地址
	 * @param requestMethod
	 *            请求方式(GET、POST)
	 * @param outputStr
	 *            提交的数据
	 * @return JSONObject(通过JSONObject.get(key)的方式获取json对象的属性值)
	 */
	public static JSONObject httpsRequest(String requestUrl, String requestMethod, String outputStr) {
		JSONObject jsonObject = null;
		try {
			// 创建SSLContext对象,并使用我们指定的信任管理器初始化
			TrustManager[] tm = { new MyX509TrustManager() };
			SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
			sslContext.init(null, tm, new java.security.SecureRandom());
			// 从上述SSLContext对象中得到SSLSocketFactory对象
			SSLSocketFactory ssf = sslContext.getSocketFactory();

			URL url = new URL(requestUrl);
			HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
			conn.setSSLSocketFactory(ssf);

			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			// 设置请求方式(GET/POST)
			conn.setRequestMethod(requestMethod);

			// 当outputStr不为null时向输出流写数据
			if (null != outputStr) {
				OutputStream outputStream = conn.getOutputStream();
				// 注意编码格式
				outputStream.write(outputStr.getBytes("UTF-8"));
				outputStream.close();
			}

			// 从输入流读取返回内容
			InputStream inputStream = conn.getInputStream();
			InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "utf-8");
			BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
			String str = null;
			StringBuffer buffer = new StringBuffer();
			while ((str = bufferedReader.readLine()) != null) {
				buffer.append(str);
			}

			// 释放资源
			bufferedReader.close();
			inputStreamReader.close();
			inputStream.close();
			inputStream = null;
			conn.disconnect();
			jsonObject = JSONObject.fromObject(buffer.toString());
		} catch (ConnectException ce) {
			log.error("连接超时:{}", ce);
		} catch (Exception e) {
			log.error("https请求异常:{}", e);
		}
		return jsonObject;
	}

	/**
	 * 获取接口访问凭证
	 *
	 * @param appid
	 *            凭证
	 * @param appsecret
	 *            密钥
	 * @return
	 */
	public static Token getToken(String appid, String appsecret) {
		Token token = null;
		String requestUrl = token_url.replace("APPID", APPID).replace("APPSECRET", APPSECRET);
		// 发起GET请求获取凭证
		JSONObject jsonObject = httpsRequest(requestUrl, "GET", null);

		if (null != jsonObject) {
			try {
				token = new Token();
				token.setAccessToken(jsonObject.getString("access_token"));
				token.setExpiresIn(jsonObject.getInt("expires_in"));
			} catch (JSONException e) {
				token = null;
				// 获取token失败
				log.error("获取token失败 errcode:{} errmsg:{}", jsonObject.getInt("errcode"),
						jsonObject.getString("errmsg"));
			}
		}
		return token;
	}

	/**
	 * URL编码(utf-8)
	 *
	 * @param source
	 * @return
	 */
	public static String urlEncodeUTF8(String source) {
		String result = source;
		try {
			result = java.net.URLEncoder.encode(source, "utf-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return result;
	}

	/**
	 * 根据内容类型判断文件扩展名
	 *
	 * @param contentType
	 *            内容类型
	 * @return
	 */
	public static String getFileExt(String contentType) {
		String fileExt = "";
		if ("image/jpeg".equals(contentType))
			fileExt = ".jpg";
		else if ("audio/mpeg".equals(contentType))
			fileExt = ".mp3";
		else if ("audio/amr".equals(contentType))
			fileExt = ".amr";
		else if ("video/mp4".equals(contentType))
			fileExt = ".mp4";
		else if ("video/mpeg4".equals(contentType))
			fileExt = ".mp4";
		return fileExt;
	}
}


text:
REM     Licensed to the Apache Software Foundation (ASF) under one
REM     or more contributor license agreements.  See the NOTICE file
REM     distributed with this work for additional information
REM     regarding copyright ownership.  The ASF licenses this file
REM     to you under the Apache License, Version 2.0 (the
REM     "License"); you may not use this file except in compliance
REM     with the License.  You may obtain a copy of the License at
REM
REM       http://www.apache.org/licenses/LICENSE-2.0
REM
REM     Unless required by applicable law or agreed to in writing,
REM     software distributed under the License is distributed on an
REM     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
REM     KIND, either express or implied.  See the License for the
REM     specific language governing permissions and limitations
REM     under the License.

IF NOT EXIST ..\config.bat GOTO noconfig
call ..\config.bat

EXIT 0

:noconfig
echo File config.bat not found. Please copy it from config.bat.tmpl and tweak for you.
EXIT 2


text:
<?php

namespace JotPoll\Exceptions;

/**
 * Soft Exception
 */
class JotPollException extends Exception {}

?>


text:
Ext.define('Neptune.view.panel.widget.NoTitle', {
    extend: 'Ext.panel.Panel',
    xtype: 'noTitlePanel',
    html: NeptuneAppData.dummyText
});


text:
import { Map } from 'immutable';
import { userFormReducer } from './userForm.reducer';
import { INITIAL_STATE } from './userForm.initial-state';
import { UserFormActions } from '../../actions/userForm/userForm.actions';

describe('UserForm Reducer', () => {
  let initialState = INITIAL_STATE;

  beforeEach(() => {
    initialState = userFormReducer(undefined, { type: 'TEST_INIT' });
  });

  it('should have an immutable initial state', () => {
    expect(Map.isMap(initialState)).toBe(true);
  });

  it('should set userSigning to true on LOGIN_FORM_IN', () => {
    const previousState = initialState;
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.LOGIN_FORM_IN });

    expect(previousState.getIn(['userSigning'])).toBe(false);
    expect(previousState.getIn(['userSignup'])).toBe(false);

    expect(nextState.getIn(['userSigning'])).toBe(true);
    expect(nextState.getIn(['userSignup'])).toBe(false);
  });

  it('should set userSigning to false on LOGIN_FORM_OUT', () => {
    const previousState = userFormReducer(initialState,
      { type: UserFormActions.LOGIN_FORM_IN });
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.LOGIN_FORM_OUT });

    expect(previousState.getIn(['userSigning'])).toBe(true);
    expect(previousState.getIn(['userSignup'])).toBe(false);

    expect(nextState.getIn(['userSigning'])).toBe(false);
    expect(nextState.getIn(['userSignup'])).toBe(false);
  });

  it('should set userSignup to true on REGISTER_FORM_IN', () => {
    const previousState = initialState;
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.REGISTER_FORM_IN });

    expect(previousState.getIn(['userSigning'])).toBe(false);
    expect(previousState.getIn(['userSignup'])).toBe(false);

    expect(nextState.getIn(['userSigning'])).toBe(false);
    expect(nextState.getIn(['userSignup'])).toBe(true);
  });

  it('should set userSignup to false on REGISTER_FORM_OUT', () => {
    const previousState = userFormReducer(initialState,
      { type: UserFormActions.REGISTER_FORM_IN });
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.REGISTER_FORM_OUT });

    expect(previousState.getIn(['userSigning'])).toBe(false);
    expect(previousState.getIn(['userSignup'])).toBe(true);

    expect(nextState.getIn(['userSigning'])).toBe(false);
    expect(nextState.getIn(['userSignup'])).toBe(false);
  });

  it('should set swap userSigning and userSignup on REGISTER_FORM_IN', () => {
    const previousState = userFormReducer(initialState,
      { type: UserFormActions.LOGIN_FORM_IN });
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.REGISTER_FORM_IN });

    expect(previousState.getIn(['userSigning'])).toBe(true);
    expect(previousState.getIn(['userSignup'])).toBe(false);

    expect(nextState.getIn(['userSigning'])).toBe(false);
    expect(nextState.getIn(['userSignup'])).toBe(true);
  });

  it('should set swap userSignup and userSigning on LOGIN_FORM_IN', () => {
    const previousState = userFormReducer(initialState,
      { type: UserFormActions.REGISTER_FORM_IN });
    const nextState = userFormReducer(previousState,
      { type: UserFormActions.LOGIN_FORM_IN });

    expect(previousState.getIn(['userSigning'])).toBe(false);
    expect(previousState.getIn(['userSignup'])).toBe(true);

    expect(nextState.getIn(['userSigning'])).toBe(true);
    expect(nextState.getIn(['userSignup'])).toBe(false);
  });
});


text:
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.6">
  <compounddef id="structboost_1_1geometry_1_1resolve__variant_1_1comparable__distance_3_01boost_1_1variant_3_01_b_e90ab1a21cdf0a14e94f94bf0f748dd6" kind="struct" prot="public">
    <compoundname>boost::geometry::resolve_variant::comparable_distance< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2 ></compoundname>
    <includes local="no">interface.hpp</includes>
    <innerclass refid="structboost_1_1geometry_1_1resolve__variant_1_1comparable__distance_3_01boost_1_1variant_3_01_b_5bee4a4e17b61189349371d1021d0bd6" prot="public">boost::geometry::resolve_variant::comparable_distance< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2 >::visitor</innerclass>
    <templateparamlist>
      <param>
        <type>BOOST_VARIANT_ENUM_PARAMS(typename T)</type>
      </param>
      <param>
        <type>typename Geometry2</type>
      </param>
    </templateparamlist>
      <sectiondef kind="public-static-func">
      <memberdef kind="function" id="structboost_1_1geometry_1_1resolve__variant_1_1comparable__distance_3_01boost_1_1variant_3_01_b_e90ab1a21cdf0a14e94f94bf0f748dd6_1a9ddf7b31185c3a08c2e717415973d25b" prot="public" static="yes" const="no" explicit="no" inline="yes" virt="non-virtual">
        <templateparamlist>
          <param>
            <type>typename Strategy</type>
          </param>
        </templateparamlist>
        <type><ref refid="structboost_1_1geometry_1_1resolve__variant_1_1comparable__distance__result" kindref="compound">comparable_distance_result</ref>< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2, Strategy >::type</type>
        <definition>static comparable_distance_result< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2, Strategy >::type boost::geometry::resolve_variant::comparable_distance< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2 >::apply</definition>
        <argsstring>(boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> const &geometry1, Geometry2 const &geometry2, Strategy const &strategy)</argsstring>
        <name>apply</name>
        <param>
          <type>boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)> const &</type>
          <declname>geometry1</declname>
        </param>
        <param>
          <type>Geometry2 const &</type>
          <declname>geometry2</declname>
        </param>
        <param>
          <type>Strategy const &</type>
          <declname>strategy</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="/home/travis/build/boostorg/boost/boost/geometry/algorithms/detail/comparable_distance/interface.hpp" line="163" column="1" bodyfile="/home/travis/build/boostorg/boost/boost/geometry/algorithms/detail/comparable_distance/interface.hpp" bodystart="163" bodyend="168"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <location file="/home/travis/build/boostorg/boost/boost/geometry/algorithms/detail/comparable_distance/interface.hpp" line="117" column="1" bodyfile="/home/travis/build/boostorg/boost/boost/geometry/algorithms/detail/comparable_distance/interface.hpp" bodystart="112" bodyend="169"/>
    <listofallmembers>
      <member refid="structboost_1_1geometry_1_1resolve__variant_1_1comparable__distance_3_01boost_1_1variant_3_01_b_e90ab1a21cdf0a14e94f94bf0f748dd6_1a9ddf7b31185c3a08c2e717415973d25b" prot="public" virt="non-virtual"><scope>boost::geometry::resolve_variant::comparable_distance< boost::variant< BOOST_VARIANT_ENUM_PARAMS(T)>, Geometry2 ></scope><name>apply</name></member>
    </listofallmembers>
  </compounddef>
</doxygen>


text:
'use strict';

var debug = require('debug')('changelog:getGitLogCommands');

function getGitLogCommands() {
  debug('getting log commands');
  this.cmd.gitLog = 'git log --grep="%s" -i -E --format=%s %s..' + (this.options.branch ? this.options.branch : 'HEAD') + ' --';
  this.cmd.gitLogNoTag = 'git log ' + this.options.branch + ' --grep="%s" -i -E --format=%s';
}

module.exports = getGitLogCommands;


text:
import argparse
import sys
import os
from contextlib import closing

sys.path.append(os.path.abspath('../django/'))
import OCP.settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'OCP.settings'
from django.conf import settings

import django
django.setup()

from ocpuser.models import *

import ocpcarest
import ocpcadb
import ocpcaproj

class CAJALProject( ):

  def __init__( self ):
    self.version = '1.8.0'

  def createProject( self, project ):
    try:
      existing_proj = Project.objects.get( project_name = project['name'] )
      print "Project {} already exists! Skipping creation of project and token...".format(project['name'])
    except Project.DoesNotExist, e:

      new_project = Project()
      new_project.project_name = project['name']
      new_project.user = User.objects.get(id=1)
      new_project.decription = "Test Project for CAJAL v{}".format( self.version )
      new_project.public = 0
      new_project.dataset = self.getDataset(project['dataset'])
      new_project.host = 'localhost'
      new_project.kvengine = 'MySQL'
      new_project.kvserver = 'localhost'
      new_project.ocp_version = '0.6'
      new_project.schema_version = '0.6'
      new_project.save()

      pd = ocpcaproj.OCPCAProjectsDB()
      pd.newOCPCAProject( new_project.project_name )

      tk = Token ( token_name = new_project.project_name, token_description = 'Default token for projet {}'.format( new_project.project_name ), project_id = new_project, public = 0, user = new_project.user )
      tk.save()

  def createChannel( self, channel, project ):
    proj_obj = Project.objects.get( project_name = project['name'] )
    try:
      existing_channel = Channel.objects.get( channel_name = channel['name'], project = proj_obj )
      print "Channel {} already exists for project {}! Skipping creation...".format(channel['name'], project['name'])

    except Channel.DoesNotExist, e:

      new_channel = Channel()
      new_channel.project = proj_obj
      new_channel.channel_name = channel['name']
      new_channel.description = channel['desc']
      new_channel.channel_type = channel['type']
      new_channel.resolution = channel['res']
      new_channel.propagate = channel['propagate']
      new_channel.channel_datatype = channel['datatype']
      new_channel.readonly = 0
      new_channel.exceptions = channel['exceptions']
      new_channel.save()

      try:
        pd = ocpcaproj.OCPCAProjectsDB()
        pd.newOCPCAChannel( project['name'], channel['name'] )
      except Exception, e:
        print e
        exit()

  def getDataset( self, dataset_name ):
    dataset = Dataset.objects.get( dataset_name = dataset_name )
    return dataset

def main():

  cp = CAJALProject()

  project = {
      'name': 'apiUnitTests',
      'dataset': 'kasthuri11',
      }

  channels = []
  # Annotation Test Channel
  channels.append({
      'name': 'apiUnitTestKasthuri',
      'desc': 'Annotation Unit Test Channel',
      'type': 'annotation',
      'datatype': 'uint32',
      'propagate': 2,
      'res': 1,
      'exceptions': 1,
      })
  # Probmap Test Channel
  channels.append({
      'name': 'apiUnitTestKasthuriProb',
      'desc': 'Probmap Unit Test Channel (now of type image)',
      'type': 'image',
      'datatype': 'float32',
      'propagate': 2,
      'res': 1,
      'exceptions': 0,
      })
  # Image Test Channel
  channels.append({
      'name': 'apiUnitTestImageUpload',
      'desc': 'Image Upload Unit Test Channel',
      'type': 'image',
      'datatype': 'uint8',
      'propagate': 2,
      'res': 1,
      'exceptions': 0,
      })
  # Propagate Test Channel
  channels.append({
      'name': 'apiUnitTestPropagate',
      'desc': 'Propagate Unit Test Channel',
      'type': 'annotation',
      'datatype': 'uint32',
      'propagate': 2,
      'res': 1,
      'exceptions': 1,
      })

  cp.createProject(project)
  for channel in channels:
    cp.createChannel(channel, project)

if __name__ == '__main__':
  main()


text:
{-# LANGUAGE NoMonomorphismRestriction #-}

module Language.Lambda.Parser (parseLambda) where

import Language.Lambda
import Text.Parsec

lexpr = try term
    <|> (try $ between (char '(') (char ')') application)
    <|> abstraction
    <?> "lambda expression"

term = do
  var <- variable
  return (Term var)

variable = do
  result <- many1 (noneOf "()λ\\,. \n\t")
  return (Var result)

application = do
  skipMany space
  exprs <- lexpr `endBy` (many space)
  skipMany space
  return (foldl1 (:$) exprs)

commaSep = do
  skipMany space
  char ','
  skipMany space

abstraction = do
  oneOf "λ\\"
  skipMany space
  vars <- variable `sepBy` commaSep
  skipMany space
  char '.'
  skipMany space
  body <- application
  return (foldr (:->) body vars)

parseLambda = parse application "(lambda)"


text:
Node helper to access pico ups info for pimodules' [HV3.0a 450 model](http://www.pimodulescart.com/shop/item.aspx?itemid=30)

[![NPM Downloads](https://img.shields.io/npm/dt/node-raspi-pico-ups.svg?style=flat-square)](https://www.npmjs.com/node-raspi-pico-ups)
[![License](https://img.shields.io/npm/l/node-raspi-pico-ups.svg?style=flat-square)](https://opensource.org/licenses/MIT)
[![NPM Version](https://img.shields.io/npm/v/node-raspi-pico-ups.svg?style=flat-square)](https://npmjs.org/node-raspi-pico-ups)

## Installation

### NPM

```bash
npm install --save node-raspi-pico-ups
```

## Usage

### getPowerModeLabel
Retrurn the label of the power mode (usb or battery)
```javascript
var pico = require('node-raspi-pico-ups');

console.log('Current power mode :', pico.getPowerModeLabel(val));
//Current power mode : usb
```
### getCurrentPowerMode
Returns the current battery mode (1 for usb, 2 for battery)
```javascript
var pico = require('node-raspi-pico-ups');

console.log('Current power mode :', pico.getCurrentPowerMode());
//Current power mode : 1
```

### getCurrentBatteryVoltage
Returns the battery voltage
```javascript
var pico = require('node-raspi-pico-ups');

console.log('Current Battery voltage :', pico.getCurrentBatteryVoltage(), 'V');
//Current Battery voltage : 4.21 V
```

### getCurrentRpiVoltage
Returns the raspberry's current power supply voltage
```javascript
var pico = require('node-raspi-pico-ups');

console.log('Current Power voltage :', pico.getCurrentRpiVoltage(), 'V');
//Current Power voltage : 4.882 V
```

### getTemperature
Returns the temperature mesured by the embedded NTC1 sensor
```javascript
var pico = require('node-raspi-pico-ups');

console.log('Temperature :', pico.getTemperature(), '°C');
//Temperature : 50 °C
```

### printInfo
Prints collected info to the console
```javascript
var pico = require('node-raspi-pico-ups');

pico.printInfo();
```
renders :
```bash
Current power mode : usb
Current Battery voltage : 4.21 V
Current Power voltage : 4.882 V
Temperature : 50 °C
```


text:
#ifndef ANDROID_OVERLAY_INTERFACE_H
#define ANDROID_OVERLAY_INTERFACE_H

#include <cutils/native_handle.h>

#include <hardware/hardware.h>

#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>

__BEGIN_DECLS

/**
 * The id of this module
 */
#define OVERLAY_HARDWARE_MODULE_ID "overlay"

/**
 * Name of the overlay device to open
 */
#define OVERLAY_HARDWARE_CONTROL    "control"
#define OVERLAY_HARDWARE_DATA       "data"

/*****************************************************************************/

/* possible overlay formats */
enum {
    OVERLAY_FORMAT_RGBA_8888    = HAL_PIXEL_FORMAT_RGBA_8888,
    OVERLAY_FORMAT_RGB_565      = HAL_PIXEL_FORMAT_RGB_565,
    OVERLAY_FORMAT_BGRA_8888    = HAL_PIXEL_FORMAT_BGRA_8888,
    OVERLAY_FORMAT_YCbYCr_422_I = 0x14,
    OVERLAY_FORMAT_CbYCrY_422_I = 0x16,
#ifdef OMAP_ENHANCEMENT
    OVERLAY_FORMAT_YCbCr_422_SP = HAL_PIXEL_FORMAT_YCbCr_422_SP,
    OVERLAY_FORMAT_YCbCr_420_SP = HAL_PIXEL_FORMAT_YCbCr_420_SP,
    OVERLAY_FORMAT_CbYCrY_420_I = HAL_PIXEL_FORMAT_CbYCrY_420_I,
    OVERLAY_FORMAT_YCbYCr_420_I = HAL_PIXEL_FORMAT_YCbCr_420_I,
    //NV12 Interlaced (Sequential Top-Bottom)
    OVERLAY_FORMAT_YCbCr_420_SP_SEQ_TB = HAL_PIXEL_FORMAT_YCbCr_420_SP_SEQ_TB,
#endif
    OVERLAY_FORMAT_DEFAULT      = 99    // The actual color format is determined
                                        // by the overlay
};

/* values for copybit_set_parameter(OVERLAY_TRANSFORM) */
enum {
    /* flip source image horizontally */
    OVERLAY_TRANSFORM_FLIP_H    = HAL_TRANSFORM_FLIP_H,
    /* flip source image vertically */
    OVERLAY_TRANSFORM_FLIP_V    = HAL_TRANSFORM_FLIP_V,
    /* rotate source image 90 degrees */
    OVERLAY_TRANSFORM_ROT_90    = HAL_TRANSFORM_ROT_90,
    /* rotate source image 180 degrees */
    OVERLAY_TRANSFORM_ROT_180   = HAL_TRANSFORM_ROT_180,
    /* rotate source image 270 degrees */
    OVERLAY_TRANSFORM_ROT_270   = HAL_TRANSFORM_ROT_270
};

/* names for setParameter() */
enum {
    /* rotation of the source image in degrees (0 to 359) */
    OVERLAY_ROTATION_DEG  = 1,
    /* enable or disable dithering */
    OVERLAY_DITHER        = 3,
    /* transformation applied (this is a superset of COPYBIT_ROTATION_DEG) */
    OVERLAY_TRANSFORM    = 4,
    /* enable or disable HDMI Mirroring of Video */
    OVERLAY_HDMI_ENABLE  = 8,
#ifdef OMAP_ENHANCEMENT
     /* plane alpha value */
    OVERLAY_PLANE_ALPHA        = 2,
    /* z-order for the plane */
    OVERLAY_PLANE_Z_ORDER              = 5,
    /* color key control support */
    OVERLAY_COLOR_KEY                  = 6,
    /* set the number of Overlay Buffers */
    OVERLAY_NUM_BUFFERS                        = 7,
    /* set the Display panel Width */
    OVERLAY_SET_DISPLAY_WIDTH  = 8,
    /* set the Display panel Height */
    OVERLAY_SET_DISPLAY_HEIGHT         = 9,
    /* screen selection*/
    OVERLAY_SET_SCREEN_ID = 10,
    /* Stereo 3D display mode */
    OVERLAY_SET_S3D_MODE = 11,
    /* Frame format */
    OVERLAY_SET_S3D_FORMAT = 12,
    /* Frame order */
    OVERLAY_SET_S3D_ORDER = 13,
    /* Frame subsampling s*/
    OVERLAY_SET_S3D_SUBSAMPLING =14,
#endif
};

#ifdef OMAP_ENHANCEMENT
/* values for the possible screen IDs */
enum {
    /* primary display panel */
    OVERLAY_ON_PRIMARY                         = 0,
    /* secondary display panel */
    OVERLAY_ON_SECONDARY               = 1,
    /* external display: HDTV */
    OVERLAY_ON_TV                              = 2,
    /* PICO DLP */
    OVERLAY_ON_PICODLP                 = 3,
    /* virtual display sink */
    OVERLAY_ON_VIRTUAL_SINK            = 4
};

/*values for possible S3D modes*/
enum {
    OVERLAY_S3D_MODE_OFF = 0,
    OVERLAY_S3D_MODE_ON = 1,
    OVERLAY_S3D_MODE_ANAGLYPH = 2,
};

/*values for possible S3D format types*/
enum {
    OVERLAY_S3D_FORMAT_NONE = 0,
    OVERLAY_S3D_FORMAT_OVERUNDER,
    OVERLAY_S3D_FORMAT_SIDEBYSIDE,
    OVERLAY_S3D_FORMAT_ROW_IL,
    OVERLAY_S3D_FORMAT_COL_IL,
    OVERLAY_S3D_FORMAT_PIX_IL,
    OVERLAY_S3D_FORMAT_CHECKB,
    OVERLAY_S3D_FORMAT_FRM_SEQ,
};

/*values for possible S3D order types*/
enum {
    OVERLAY_S3D_ORDER_LF = 0,
    OVERLAY_S3D_ORDER_RF,
};

/*values for possible S3D subsampling modes*/
enum {
    OVERLAY_S3D_SS_NONE = 0,
    OVERLAY_S3D_SS_HOR,
    OVERLAY_S3D_SS_VERT,
};
#endif
/* enable/disable value setParameter() */
enum {
    OVERLAY_DISABLE = 0,
    OVERLAY_ENABLE  = 1
};

/* names for get() */
enum {
    /* Maximum amount of minification supported by the hardware*/
    OVERLAY_MINIFICATION_LIMIT      = 1,
    /* Maximum amount of magnification supported by the hardware */
    OVERLAY_MAGNIFICATION_LIMIT     = 2,
    /* Number of fractional bits support by the overlay scaling engine */
    OVERLAY_SCALING_FRAC_BITS       = 3,
    /* Supported rotation step in degrees. */
    OVERLAY_ROTATION_STEP_DEG       = 4,
    /* horizontal alignment in pixels */
    OVERLAY_HORIZONTAL_ALIGNMENT    = 5,
    /* vertical alignment in pixels */
    OVERLAY_VERTICAL_ALIGNMENT      = 6,
    /* width alignment restrictions. negative number for max. power-of-two */
    OVERLAY_WIDTH_ALIGNMENT         = 7,
    /* height alignment restrictions. negative number for max. power-of-two */
    OVERLAY_HEIGHT_ALIGNMENT        = 8,
};

/*****************************************************************************/

/* opaque reference to an Overlay kernel object */
typedef const native_handle* overlay_handle_t;

typedef struct overlay_t {
    uint32_t            w;
    uint32_t            h;
    int32_t             format;
    uint32_t            w_stride;
    uint32_t            h_stride;
    uint32_t            reserved[3];
    /* returns a reference to this overlay's handle (the caller doesn't
     * take ownership) */
    overlay_handle_t    (*getHandleRef)(struct overlay_t* overlay);
    uint32_t            reserved_procs[7];
} overlay_t;

typedef void* overlay_buffer_t;

/*****************************************************************************/

/**
 * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
 * and the fields of this data structure must begin with hw_module_t
 * followed by module specific information.
 */
struct overlay_module_t {
    struct hw_module_t common;
};

/*****************************************************************************/

/**
 * Every device data structure must begin with hw_device_t
 * followed by module specific public methods and attributes.
 */

struct overlay_control_device_t {
    struct hw_device_t common;

    /* get static informations about the capabilities of the overlay engine */
    int (*get)(struct overlay_control_device_t *dev, int name);

    /* creates an overlay matching the given parameters as closely as possible.
     * returns an error if no more overlays are available. The actual
     * size and format is returned in overlay_t. */
    overlay_t* (*createOverlay)(struct overlay_control_device_t *dev,
            uint32_t w, uint32_t h, int32_t format);

#ifdef OMAP_ENHANCEMENT
     /* Overloaded function for S3D Overlay creation.  Used to load V4L2_S3D driver*/
    overlay_t* (*createOverlay_S3D)(struct overlay_control_device_t *dev,
            uint32_t w, uint32_t h, int32_t format, int isS3D);
#endif
    /* destroys an overlay. This call releases all
     * resources associated with overlay_t and make it invalid */
    void (*destroyOverlay)(struct overlay_control_device_t *dev,
            overlay_t* overlay);

    /* set position and scaling of the given overlay as closely as possible.
     * if scaling cannot be performed, overlay must be centered. */
    int (*setPosition)(struct overlay_control_device_t *dev,
            overlay_t* overlay,
            int x, int y, uint32_t w, uint32_t h);

    /* returns the actual position and size of the overlay */
    int (*getPosition)(struct overlay_control_device_t *dev,
            overlay_t* overlay,
            int* x, int* y, uint32_t* w, uint32_t* h);

    /* sets configurable parameters for this overlay. returns an error if not
     * supported. */
    int (*setParameter)(struct overlay_control_device_t *dev,
            overlay_t* overlay, int param, int value);

    int (*stage)(struct overlay_control_device_t *dev, overlay_t* overlay);
    int (*commit)(struct overlay_control_device_t *dev, overlay_t* overlay);

#ifdef OMAP_ENHANCEMENT
    int (*requestOverlayClone)(struct overlay_control_device_t* dev, overlay_t* overlay,int enable);
#endif

};

struct overlay_data_device_t {
    struct hw_device_t common;

    /* initialize the overlay from the given handle. this associates this
     * overlay data module to its control module */
    int (*initialize)(struct overlay_data_device_t *dev,
            overlay_handle_t handle);

    /* can be called to change the width and height of the overlay. */
    int (*resizeInput)(struct overlay_data_device_t *dev,
            uint32_t w, uint32_t h);

    int (*setCrop)(struct overlay_data_device_t *dev,
            uint32_t x, uint32_t y, uint32_t w, uint32_t h) ;

    int (*getCrop)(struct overlay_data_device_t *dev,
       uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h) ;

    int (*setParameter)(struct overlay_data_device_t *dev,
            int param, int value);

    /* blocks until an overlay buffer is available and return that buffer. */
    int (*dequeueBuffer)(struct overlay_data_device_t *dev,
		         overlay_buffer_t *buf);

    /* release the overlay buffer and post it */
    int (*queueBuffer)(struct overlay_data_device_t *dev,
            overlay_buffer_t buffer);

    /* returns the address of a given buffer if supported, NULL otherwise. */
    void* (*getBufferAddress)(struct overlay_data_device_t *dev,
            overlay_buffer_t buffer);

    int (*getBufferCount)(struct overlay_data_device_t *dev);

#ifdef OMAP_ENHANCEMENT
    /* For setting Stereo Parameters on-the-fly */
   int (*set_s3d_params)(struct overlay_data_device_t *dev, uint32_t s3d_mode,
                           uint32_t s3d_fmt, uint32_t s3d_order, uint32_t s3d_subsampling);
#endif

    int (*setFd)(struct overlay_data_device_t *dev, int fd);

};

/*****************************************************************************/

/** convenience API for opening and closing a device */

static inline int overlay_control_open(const struct hw_module_t* module,
        struct overlay_control_device_t** device) {
    return module->methods->open(module,
            OVERLAY_HARDWARE_CONTROL, (struct hw_device_t**)device);
}

static inline int overlay_control_close(struct overlay_control_device_t* device) {
    return device->common.close(&device->common);
}

static inline int overlay_data_open(const struct hw_module_t* module,
        struct overlay_data_device_t** device) {
    return module->methods->open(module,
            OVERLAY_HARDWARE_DATA, (struct hw_device_t**)device);
}

static inline int overlay_data_close(struct overlay_data_device_t* device) {
    return device->common.close(&device->common);
}

__END_DECLS

#endif  // ANDROID_OVERLAY_INTERFACE_H


text:
# Azure Database for PostgreSQL Service

[Azure Database for PostgreSQL](https://azure.microsoft.com/en-us/services/postgresql) is a relational database service based on the open source Postgres database engine. It is a fully managed database as a service offering capable of handling mission-critical workloads with predictable performance, security, high availability, and dynamic scalability.  Develop applications with Azure Database for PostgreSQL leveraging the open source tools and platform of your choice.

## Behaviors

### Provision

  1. Create a server.

### Provision-Poll

  1. Check whether creating server succeeds or not.

  2. Configure firewall rules

### Bind

  1. Collect [credentials](./azure-postgresql-db.md#format-of-credentials).

### Unbind

  Do nothing

### Deprovision

  1. Delete the server.

### Deprovision-Poll

  1. Check whether deleting server succeeds or not.

## Create an Azure Database for PostgreSQL service

1. Get the service name and plans

  ```
  cf marketplace
  ```

  Sample output:

  ```
  service              plans                                                                         description
  azure-postgresqldb   basic50*, basic100*, standard100*, standard200*, standard400*, standard800*   Azure PostgreSQL Database Service

  ```

  If you can not find the service name, please use the following command to make the plans public.

  ```
  cf enable-service-access azure-postgresqldb
  ```

2. Create a service instance

  Configuration parameters are supported with the provision request. These parameters are passed in a valid JSON object containing configuration parameters, provided either in-line or in a file.

  ```
  cf create-service azure-postgresqldb $service_plan $service_instance_name -c $path_to_parameters
  ```

  Supported configuration parameters:

  ```
  {
    "resourceGroup": "<resource-group>",        // [Required] Unique. Only allow up to 90 characters
    "location": "<azure-region-name>",          // [Required] support westus and northeurope only
    "postgresqlServerName": "<server-name>",    // [Required] Unique. Server name cannot be empty or null. It can contain only lowercase letters, numbers and '-', but can't start or end with '-' or have more than 63 characters.
    "postgresqlServerParameters": {
        "allowPostgresqlServerFirewallRules": [ // [Optional] If present, ruleName, startIpAddress and endIpAddress are mandatory in every rule.
            {
                "ruleName": "<rule-name-0>",    // The rule name can only contain 0-9, a-z, A-Z, -, _, and cannot exceed 128 characters
                "startIpAddress": "xx.xx.xx.xx",
                "endIpAddress": "xx.xx.xx.xx"
            },
            {
                "ruleName": "<rule-name-1>",
                "startIpAddress": "xx.xx.xx.xx",
                "endIpAddress": "xx.xx.xx.xx"
            }
        ],
        "properties": {
            "version": "9.5" | "9.6",
            "sslEnforcement": "Enabled" | "Disabled",
            "storageMB": 51200 | 128000 | ... | 947200,
            "administratorLogin": "<server-admin-name>",
            "administratorLoginPassword": "<server-admin-password>"
        }
    }
  }
  ```

  For example:

  ```
  cf create-service azure-postgresqldb basic100 postgresqldb -c examples/postgresqldb-example-config.json
  ```

  The contents of `examples/postgresqldb-example-config.json`:

  ```
  {
      "resourceGroup": "postgresqldbResourceGroup",
      "location": "westus",
      "postgresqlServerName": "postgresqlservera",
      "postgresqlServerParameters": {
          "allowPostgresqlServerFirewallRules": [
              {
                "ruleName": "newrule",
                "startIpAddress": "0.0.0.0",
                "endIpAddress": "255.255.255.255"
              }
          ],
          "properties": {
              "version": "9.6",
              "sslEnforcement": "Disabled",
              "storageMB": 51200,
              "administratorLogin": "myusername",
              "administratorLoginPassword": "myPASSw0rd"
          }
      }
  }
  ```

**NOTE:**

  * Please remove the comments in the JSON file before you use it.

3. Check the operation status of creating the service instance

  The creating operation is asynchronous. You can get the operation status after the creating operation.

  ```
  cf service $service_instance_name
  ```

  For example:

  ```
  cf service postgresqldb
  ```

[More information](http://docs.cloudfoundry.org/devguide/services/managing-services.html#create).

## Using the services in your application

### Binding

  ```
  cf bind-service $app_name $service_instance_name
  ```

  For example:

  ```
  cf bind-service demoapp postgresqldb
  ```

### Format of Credentials

  Verify that the credentials are set as environment variables

  ```
  cf env $app_name
  ```

  The credentials have the following format:

  ```
  "credentials": {
    "postgresqlServerName": "postgresqlservera",
    "postgresqlServerFullyQualifiedDomainName": "postgresqlservera.postgres.database.azure.com",
    "administratorLogin": "ulrich",
    "administratorLoginPassword": "u1r8chP@ss",
    "jdbcUrl": "jdbc:postgresql://postgresqlservera.postgres.database.azure.com:5432/{your_database}?user=ulrich@fake-server&password=u1r8chP@ss&ssl=true"
  }

  ```

**NOTE:**

  * The character "&" in JDBC url is encoded into "\u0026" by the Cloud Controller. Your app may need to handle this.

## Unbinding

  ```
  cf unbind-service $app_name $service_instance_name
  ```

  For example:

  ```
  cf unbind-service demoapp postgresqldb
  ```

## Delete the service instance

  ```
  cf delete-service $service_instance_name -f
  ```

  For example:

  ```
  cf delete-service postgresqldb -f
  ```


text:
import logging
import irc3d
import irc3
__doc__ = '''
==========================================
:mod:`irc3.plugins.log` Log plugin
==========================================

Logging / debuging plugin

..
    >>> from irc3.testing import IrcBot

Usage::

    >>> bot = IrcBot()
    >>> bot.include('irc3.plugins.log')
'''

class RawLog:

    def __init__(self, context):
        self.context = context
        name = 'raw.%s' % (context.nick or 'irc3d')
        self.log_in = logging.getLogger(name + ' <<')
        self.log_in.setLevel(logging.DEBUG)
        self.log_out = logging.getLogger(name + ' >>')
        self.log_out.setLevel(logging.DEBUG)

    @irc3d.event(r'^(?P<raw>.*)', venusian_category='irc3d.debug')
    @irc3.event(r'^(?P<raw>.*)', venusian_category='irc3.debug')
    @irc3.dcc_event(r'^(?P<raw>.*)', venusian_category='irc3.debug')
    def debug_input(self, raw=None, client=None, iotype='in', **kwargs):
        self.log(raw, client, iotype)

    @irc3d.event(r'^(?P<raw>.*)', iotype='out',
                 venusian_category='irc3d.debug')
    @irc3.event(r'^(?P<raw>.*)', iotype='out', venusian_category='irc3.debug')
    @irc3.dcc_event(r'^(?P<raw>.*)', iotype='out',
                    venusian_category='irc3.debug')
    def debug_output(self, raw=None, client=None, iotype='out', **kwargs):
        self.log(raw, client, iotype)

    def log(self, raw, client=None, iotype=None):
        if raw.strip():
            log = getattr(self, 'log_' + iotype)
            if client is not None:
                log.debug('[%-7r] %s', client, raw)
            else:
                log.debug(raw)


text:
import passport from 'passport'
import { Strategy as FacebookStrategy } from 'passport-facebook'
import profile from '../../../../profile'

import { User as UserModel } from '../../../../data/models'

const {facebook} = profile

const createUser = function(accessToken, refreshToken, profile, done) {
  return UserModel.findOne({'facebook.id': profile.id})
    .exec()
    .then(user => {
      if (user) {
        return done(null, user)
      }

      user = new UserModel({
        role:     'user',
        provider: 'facebook',
        name:     profile.displayName,
        email:    profile.emails[0].value,
        username: profile.username,
        facebook: profile._json
      })

      return user.save().then(() => done(null, user), done)

    }, done)
}

export default passport.use(new FacebookStrategy({
  clientID:     facebook.clientID,
  clientSecret: facebook.clientSecret,
  callbackURL:  facebook.callbackURL
}, createUser))


text:
#include "tensorflow/compiler/xla/service/hlo_sharding.h"

#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/strings/str_util.h"

namespace xla {

using ::tensorflow::str_util::Join;
using ::tensorflow::strings::StrCat;

HloSharding HloSharding::AssignDevice(int64 device_id) {
  return HloSharding(device_id);
}

HloSharding HloSharding::Tile1D(const Shape& input_shape, int64 num_tiles) {
  CHECK_EQ(1, ShapeUtil::Rank(input_shape));
  CHECK_GT(num_tiles, 1);
  std::vector<int64> dimensions(1, num_tiles);
  Array<int64> assignment(dimensions);
  std::iota(assignment.begin(), assignment.end(), 0);
  return HloSharding(assignment);
}

HloSharding HloSharding::Tuple(const ShapeTree<HloSharding>& sub_shardings) {
  std::vector<HloSharding> flattened_list;
  flattened_list.reserve(sub_shardings.leaf_count());
  for (const auto& index_to_sharding : sub_shardings.leaves()) {
    flattened_list.push_back(index_to_sharding.second);
  }
  if (flattened_list.empty()) {
    // Empty tuple sharding ends up having no leaves, but we want to allow
    // empty tuple HLO instruction results to have sharding, so we fetch the
    // root ({}) sharding value from the ShapeTree.
    // A ShapeTree created with ShapeTree<HloSharding>(shape, init) will have
    // init as value at its root.
    flattened_list.push_back(sub_shardings.element(ShapeIndex({})));
  }
  return HloSharding(flattened_list);
}

HloSharding HloSharding::Tuple(
    const Shape& tuple_shape,
    tensorflow::gtl::ArraySlice<HloSharding> shardings) {
  CHECK(ShapeUtil::IsTuple(tuple_shape)) << ShapeUtil::HumanString(tuple_shape);
  for (auto& sharding : shardings) {
    CHECK(!sharding.IsTuple()) << sharding.ToString();
  }
  std::vector<HloSharding> flattened_list(shardings.begin(), shardings.end());
  CHECK_EQ(flattened_list.size(), RequiredLeaves(tuple_shape))
      << "Flat list has " << flattened_list.size() << ", required "
      << RequiredLeaves(tuple_shape);
  return HloSharding(flattened_list);
}

HloSharding HloSharding::SingleTuple(const Shape& tuple_shape,
                                     const HloSharding& sharding) {
  CHECK(ShapeUtil::IsTuple(tuple_shape)) << ShapeUtil::HumanString(tuple_shape);
  CHECK(!sharding.IsTuple()) << sharding.ToString();
  int64 leaf_count = ShapeUtil::GetLeafCount(tuple_shape);
  std::vector<HloSharding> flattened_list;
  flattened_list.reserve(leaf_count);
  for (int64 i = 0; i < leaf_count; ++i) {
    flattened_list.push_back(sharding);
  }
  return HloSharding(flattened_list);
}

HloSharding HloSharding::Single(const Shape& shape,
                                const HloSharding& sharding) {
  return ShapeUtil::IsTuple(shape) ? SingleTuple(shape, sharding) : sharding;
}

string HloSharding::ToString() const {
  if (IsTuple()) {
    std::vector<string> parts;
    parts.reserve(tuple_elements_.size());
    for (const HloSharding& element : tuple_elements_) {
      parts.push_back(element.ToString());
    }
    return StrCat("{", tensorflow::str_util::Join(parts, ", "), "}");
  }

  if (replicated_) {
    return "{replicated}";
  } else if (maximal_) {
    return StrCat(
        "{maximal device=", static_cast<int64>(*tile_assignment_.begin()), "}");
  } else {
    return StrCat("{devices=[", Join(tile_assignment_.dimensions(), ","), "]",
                  Join(tile_assignment_, ","), "}");
  }
}

bool HloSharding::UsesDevice(int64 device) const {
  if (IsTuple()) {
    return std::any_of(
        tuple_elements_.begin(), tuple_elements_.end(),
        [&](const HloSharding& s) { return s.UsesDevice(device); });
  }
  const auto& devices = tile_assignment_;
  return replicated_ ||
         std::find(devices.begin(), devices.end(), device) != devices.end();
}

std::map<int64, int64> HloSharding::UsedDevices(int64* count) const {
  int64 element_count = 1;
  std::map<int64, int64> device_map;
  if (IsTuple()) {
    for (auto& tuple_element_sharding : tuple_elements()) {
      auto unique_device = tuple_element_sharding.UniqueDevice();
      if (unique_device) {
        device_map[*unique_device] += 1;
      }
    }
    element_count = tuple_elements().size();
  } else {
    auto unique_device = UniqueDevice();
    if (unique_device) {
      device_map[*unique_device] += 1;
    }
  }
  if (count != nullptr) {
    *count = element_count;
  }
  return device_map;
}

std::vector<int64> HloSharding::TileIndexForDevice(int64 device) const {
  CHECK(!maximal_);
  CHECK(!IsTuple());
  std::vector<int64> ret_index;
  tile_assignment_.Each([&](tensorflow::gtl::ArraySlice<int64> index, int64 d) {
    if (d == device) {
      ret_index = {index.begin(), index.end()};
    }
  });
  CHECK(!ret_index.empty());
  return ret_index;
}

int64 HloSharding::DeviceForTileIndex(
    tensorflow::gtl::ArraySlice<int64> index) const {
  CHECK(!replicated_);
  CHECK(!IsTuple());
  if (maximal_) {
    return *tile_assignment_.begin();
  }
  return tile_assignment_(index);
}

std::vector<int64> HloSharding::TileOffsetForDevice(const Shape& shape,
                                                    int64 device) const {
  CHECK(!IsTuple());

  if (maximal_) {
    return std::vector<int64>(shape.dimensions_size(), 0);
  }

  CHECK_EQ(shape.dimensions_size(), tile_assignment_.num_dimensions());
  std::vector<int64> index = TileIndexForDevice(device);
  for (int64 i = 0; i < index.size(); ++i) {
    const int64 shape_dim = shape.dimensions(i);
    index[i] = std::min(
        index[i] * CeilOfRatio(shape_dim, tile_assignment_.dim(i)), shape_dim);
  }
  return index;
}

std::vector<int64> HloSharding::TileLimitForDevice(const Shape& shape,
                                                   int64 device) const {
  CHECK(!IsTuple());

  if (maximal_) {
    return std::vector<int64>(shape.dimensions().begin(),
                              shape.dimensions().end());
  }

  CHECK_EQ(shape.dimensions_size(), tile_assignment_.num_dimensions());
  std::vector<int64> index = TileIndexForDevice(device);
  for (int64 i = 0; i < index.size(); ++i) {
    const int64 shape_dim = shape.dimensions(i);
    index[i] = std::min(
        (index[i] + 1) * CeilOfRatio(shape_dim, tile_assignment_.dim(i)),
        shape_dim);
  }
  return index;
}

int64 HloSharding::RequiredLeaves(const Shape& shape) {
  // Empty tuples have no leaf nodes as far as ShapeUtil and ShapeTree are
  // concerned, but they do have a single tuple_elements_ entry since we want
  // to allow empty tuple results to have sharding.
  return ShapeUtil::IsEmptyTuple(shape) ? 1 : ShapeUtil::GetLeafCount(shape);
}

Status HloSharding::CheckLeafCount(const Shape& shape) const {
  int64 shape_leaves = RequiredLeaves(shape);
  TF_RET_CHECK(shape_leaves == tuple_elements_.size())
      << "Shape " << ShapeUtil::HumanString(shape) << " has " << shape_leaves
      << " leaf nodes while this sharding has " << tuple_elements_.size();
  return Status::OK();
}

StatusOr<ShapeTree<HloSharding>> HloSharding::AsShapeTree(
    const Shape& shape) const {
  if (IsTuple()) {
    ShapeTree<HloSharding> result(shape, HloSharding::Replicate());
    TF_RETURN_IF_ERROR(CheckLeafCount(shape));
    auto it = tuple_elements_.begin();
    for (auto& index_to_sharding : result.leaves()) {
      index_to_sharding.second = *it++;
    }
    if (ShapeUtil::IsEmptyTuple(shape)) {
      // Empty tuples have no leaves, but we want to assign them a sharding
      // anyway, so we use the root element sharding.
      *result.mutable_element(ShapeIndex({})) = *it;
    }
    return std::move(result);
  } else {
    return ShapeTree<HloSharding>(shape, *this);
  }
}

StatusOr<HloSharding> HloSharding::GetTupleSharding(const Shape& shape) const {
  if (IsTuple()) {
    TF_RETURN_IF_ERROR(CheckLeafCount(shape));
    return *this;
  }
  return Tuple(ShapeTree<HloSharding>(shape, *this));
}

tensorflow::gtl::optional<int64> HloSharding::UniqueDevice() const {
  if (IsTuple()) {
    if (tuple_elements_.empty()) {
      return tensorflow::gtl::nullopt;
    }
    tensorflow::gtl::optional<int64> unique_device;
    for (auto& tuple_sharding : tuple_elements_) {
      auto device = tuple_sharding.UniqueDevice();
      if (!device || (unique_device && *device != *unique_device)) {
        return tensorflow::gtl::nullopt;
      }
      unique_device = device;
    }
    return unique_device;
  }
  if (!replicated_ && maximal_) {
    return static_cast<int64>(*tile_assignment_.begin());
  }
  return tensorflow::gtl::nullopt;
}

int64 HloSharding::GetUniqueDevice() const {
  auto device = UniqueDevice();
  CHECK(device) << "Sharding does not have a unique device: " << *this;
  return *device;
}

Status HloSharding::ValidateTuple(const Shape& shape, int64 num_devices) const {
  if (!ShapeUtil::IsTuple(shape)) {
    return tensorflow::errors::InvalidArgument(
        StrCat("Sharding is tuple-shaped but validation shape is not."));
  }
  TF_RETURN_IF_ERROR(CheckLeafCount(shape));

  // Now we've validated the number of tuple elements, it's safe to request a
  // shape tree.
  ShapeTree<HloSharding> shape_tree = GetAsShapeTree(shape);
  for (const auto& index_to_sharding : shape_tree.leaves()) {
    Status status = index_to_sharding.second.ValidateNonTuple(
        ShapeUtil::GetSubshape(shape, index_to_sharding.first), num_devices);
    if (!status.ok()) {
      tensorflow::errors::AppendToMessage(
          &status, StrCat("Note: While validating sharding tuple element ",
                          index_to_sharding.first.ToString(), " which is ",
                          index_to_sharding.second.ToString()));
      return status;
    }
  }
  return Status::OK();
}

Status HloSharding::Validate(const Shape& shape, int64 num_devices) const {
  Status status = IsTuple() ? ValidateTuple(shape, num_devices)
                            : ValidateNonTuple(shape, num_devices);
  if (!status.ok()) {
    tensorflow::errors::AppendToMessage(
        &status, StrCat("Note: While validating sharding ", ToString(),
                        " against shape ", ShapeUtil::HumanString(shape)));
  }
  return status;
}

Status HloSharding::ValidateNonTuple(const Shape& shape,
                                     int64 num_devices) const {
  if (ShapeUtil::IsTuple(shape)) {
    return tensorflow::errors::InvalidArgument(
        StrCat("Validation shape is a tuple but sharding is not."));
  }
  if (replicated_) {
    return Status::OK();
  }

  // All tile assignments must be less than the number of available cores and
  // unique.
  Status status = Status::OK();
  std::set<int64> seen_cores;
  tile_assignment_.Each(
      [&](tensorflow::gtl::ArraySlice<int64> indices, int32 core) {
        // Don't overwrite a bad status, so we report the first error.
        if (status.ok()) {
          if (core >= num_devices) {
            status = tensorflow::errors::InvalidArgument(StrCat(
                "core ", core, " > ", num_devices, " in tile assignment"));
          } else if (seen_cores.count(core) != 0) {
            status = tensorflow::errors::InvalidArgument(
                StrCat("core ", core, " is not unique in tile assignment"));
          }
        }
        seen_cores.insert(core);
      });
  if (!status.ok()) {
    return status;
  }

  if (IsTileMaximal()) {
    return Status::OK();
  }

  // The tile assignment tensor must have the same rank as the input.
  if (ShapeUtil::Rank(shape) != tile_assignment_.num_dimensions()) {
    return tensorflow::errors::InvalidArgument(
        "Number of tile assignment dimensions is different to the input rank. "
        "sharding=",
        ToString(), ", input_shape=", ShapeUtil::HumanString(shape));
  }

  // The correct constructor have to be used to create tile maximal shardings.
  if (tile_assignment_.num_elements() == 1) {
    return tensorflow::errors::InvalidArgument(
        "Tile assignment only contains a single device. If a replicated "
        "sharding was intended, use HloSharding::Replicated(). If a device "
        "placement was intended, use HloSharding::AssignDevice()");
  }
  return Status::OK();
}

/*static*/ StatusOr<HloSharding> HloSharding::FromProto(
    const OpSharding& proto) {
  if (proto.type() == OpSharding::Type::OpSharding_Type_TUPLE) {
    std::vector<HloSharding> tuple_shardings;
    tuple_shardings.reserve(proto.tuple_shardings().size());
    for (const OpSharding& tuple_sharding_proto : proto.tuple_shardings()) {
      TF_ASSIGN_OR_RETURN(HloSharding sharding,
                          HloSharding::FromProto(tuple_sharding_proto));
      tuple_shardings.push_back(sharding);
    }
    return HloSharding(tuple_shardings);
  } else if (proto.type() == OpSharding::Type::OpSharding_Type_REPLICATED) {
    return Replicate();
  } else if (proto.type() == OpSharding::Type::OpSharding_Type_MAXIMAL ||
             proto.tile_assignment_devices().size() == 1) {
    return HloSharding(proto.tile_assignment_devices(0));
  }
  // Some versions of gcc cannot infer the TileAssignment constructor from a
  // braced initializer-list, so create one manually.
  std::vector<int64> devices(proto.tile_assignment_devices().begin(),
                             proto.tile_assignment_devices().end());
  Array<int64> tile_assignment(
      std::vector<int64>(proto.tile_assignment_dimensions().begin(),
                         proto.tile_assignment_dimensions().end()));
  std::copy(proto.tile_assignment_devices().begin(),
            proto.tile_assignment_devices().end(), tile_assignment.begin());
  return HloSharding(tile_assignment);
}

OpSharding HloSharding::ToProto() const {
  OpSharding result;

  if (IsTuple()) {
    for (const HloSharding& element : tuple_elements_) {
      *result.add_tuple_shardings() = element.ToProto();
    }
    result.set_type(OpSharding::Type::OpSharding_Type_TUPLE);
    return result;
  }

  for (int64 dim : tile_assignment_.dimensions()) {
    result.add_tile_assignment_dimensions(dim);
  }
  for (auto device : tile_assignment_) {
    result.add_tile_assignment_devices(device);
  }
  if (IsReplicated()) {
    result.set_type(OpSharding::Type::OpSharding_Type_REPLICATED);
  } else if (IsTileMaximal()) {
    result.set_type(OpSharding::Type::OpSharding_Type_MAXIMAL);
  } else {
    result.set_type(OpSharding::Type::OpSharding_Type_OTHER);
  }
  return result;
}

Shape HloSharding::TileShape(const Shape& shape) const {
  if (IsTileMaximal()) {
    return shape;
  }
  Shape result_shape = shape;
  for (int64 i = 0; i < shape.dimensions_size(); ++i) {
    (*result_shape.mutable_dimensions())[i] =
        CeilOfRatio<int64>(shape.dimensions(i), tile_assignment_.dim(i));
  }
  return result_shape;
}

HloSharding HloSharding::GetSubSharding(const Shape& shape,
                                        const ShapeIndex& index) const {
  CHECK(IsTuple());

  Shape sub_shape = ShapeUtil::GetSubshape(shape, index);
  ShapeTree<HloSharding> sub_shape_tree(sub_shape, Replicate());
  sub_shape_tree.CopySubtreeFrom(GetAsShapeTree(shape), index, {});
  return ShapeUtil::IsTuple(sub_shape) ? Tuple(sub_shape_tree)
                                       : sub_shape_tree.element(ShapeIndex({}));
}

tensorflow::gtl::optional<HloSharding> HloSharding::ExtractSingleSharding()
    const {
  if (!IsTuple()) {
    return *this;
  }
  for (int64 i = 1; i < tuple_elements_.size(); ++i) {
    if (tuple_elements_[0] != tuple_elements_[i]) {
      return tensorflow::gtl::optional<HloSharding>();
    }
  }
  return tuple_elements_.front();
}

size_t HloSharding::Hash() const {
  if (!tuple_) {
    size_t h = 0;
    for (const auto& element : tuple_elements_) {
      h = tensorflow::Hash64Combine(h, element.Hash());
    }
    return h;
  }
  if (replicated_) {
    return 0;
  }
  size_t h = 0;
  for (uint32 v : tile_assignment_) {
    h = tensorflow::Hash64Combine(h, std::hash<uint32>{}(v));
  }
  return h;
}

std::ostream& operator<<(std::ostream& out, const HloSharding& sharding) {
  out << sharding.ToString();
  return out;
}

}  // namespace xla


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Shrunk</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/shrunk.css') }}">
    <link rel="icon" type="image/ico" href="{{ url_for('static', filename='img/favicon.ico') }}">

Not Found

                Sorry, this link does not exist. Want to change that?

                Log in to Rutgers Shrunk and shrink some URLs.


text:
package com.google.cloud.video.livestream.v1.samples;

// [START livestream_v1_generated_LivestreamService_ListChannels_sync]
import com.google.cloud.video.livestream.v1.Channel;
import com.google.cloud.video.livestream.v1.ListChannelsRequest;
import com.google.cloud.video.livestream.v1.LivestreamServiceClient;
import com.google.cloud.video.livestream.v1.LocationName;

public class SyncListChannels {

  public static void main(String[] args) throws Exception {
    syncListChannels();
  }

  public static void syncListChannels() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (LivestreamServiceClient livestreamServiceClient = LivestreamServiceClient.create()) {
      ListChannelsRequest request =
          ListChannelsRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setPageSize(883849137)
              .setPageToken("pageToken873572522")
              .setFilter("filter-1274492040")
              .setOrderBy("orderBy-1207110587")
              .build();
      for (Channel element : livestreamServiceClient.listChannels(request).iterateAll()) {
        // doThingsWith(element);
      }
    }
  }
}
// [END livestream_v1_generated_LivestreamService_ListChannels_sync]


text:
package external.entity.fatsecret;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for exercise complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="exercise">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="exercise_id" type="{http://platform.fatsecret.com/api/1.0/}exercise_id"/>
 *         <element name="exercise_name" type="{http://platform.fatsecret.com/api/1.0/}exercise_name"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "exercise", namespace = "http://platform.fatsecret.com/api/1.0/", propOrder = {
    "exerciseId",
    "exerciseName"
})
public class Exercise {

    @XmlElement(name = "exercise_id", namespace = "http://platform.fatsecret.com/api/1.0/")
    protected long exerciseId;
    @XmlElement(name = "exercise_name", namespace = "http://platform.fatsecret.com/api/1.0/", required = true)
    protected String exerciseName;

    /**
     * Gets the value of the exerciseId property.
     *
     */
    public long getExerciseId() {
        return exerciseId;
    }

    /**
     * Sets the value of the exerciseId property.
     *
     */
    public void setExerciseId(long value) {
        this.exerciseId = value;
    }

    /**
     * Gets the value of the exerciseName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getExerciseName() {
        return exerciseName;
    }

    /**
     * Sets the value of the exerciseName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setExerciseName(String value) {
        this.exerciseName = value;
    }

}


text:
import json
import pytest

from nbformat import validate
from nbformat.v4 import new_notebook

from ...preprocessors import SaveCells, OverwriteKernelspec
from ...api import Gradebook
from .base import BaseTestPreprocessor

@pytest.fixture
def preprocessors():
    return (SaveCells(), OverwriteKernelspec())

@pytest.fixture
def gradebook(request, db):
    gb = Gradebook(db)
    gb.add_assignment("ps0")

    def fin():
        gb.close()
    request.addfinalizer(fin)

    return gb

@pytest.fixture
def resources(db, gradebook):
    return {
        "nbgrader": {
            "db_url": db,
            "assignment": "ps0",
            "notebook": "test"
        }
    }

class TestOverwriteKernelSpec(BaseTestPreprocessor):

    def test_overwrite_kernelspec(self, preprocessors, resources, gradebook):
        kernelspec = dict(
            display_name='blarg',
            name='python3',
            language='python',
        )

        nb = new_notebook()
        nb.metadata['kernelspec'] = kernelspec
        nb, resources = preprocessors[0].preprocess(nb, resources)

        nb.metadata['kernelspec'] = {}
        nb, resources = preprocessors[1].preprocess(nb, resources)

        validate(nb)
        notebook = gradebook.find_notebook("test", "ps0")
        assert nb.metadata['kernelspec'] == kernelspec
        assert json.loads(notebook.kernelspec) == kernelspec


text:
namespace Gerenciador.Repository.EntityFramwork.Migrations
{
    using System.CodeDom.Compiler;
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.Infrastructure;
    using System.Resources;

    [GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
    public sealed partial class ChangeEndDateFromTaskToNullable : IMigrationMetadata
    {
        private readonly ResourceManager Resources = new ResourceManager(typeof(ChangeEndDateFromTaskToNullable));

        string IMigrationMetadata.Id
        {
            get { return "201411010359336_ChangeEndDateFromTaskToNullable"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        string IMigrationMetadata.Target
        {
            get { return Resources.GetString("Target"); }
        }
    }
}


text:
source ./bin/utils.sh

toInstall=()
toInstallCask=()

function initXCode() {
    if [[ -d "$('xcode-select' -print-path 2>/dev/null)" ]]; then
        e_bold "Initializing XCode Command Line Tools"
        xcode-select --install 2>/dev/null
        # wait until XCode Command Line Tools are installed
        until xcode-select --print-path &> /dev/null; do
            sleep 5
        done
    fi
}

function promptToInstall() {
    test_result=$?
    name=$1; url=$2; useCask=$3
    shift 3
    app=("$@")
    [[ $test_result -eq 0 ]] && e_success "$name is already installed" || {
        e_warning "$name is not installed"
        install="h"
        while [ "$install" == "h" ]; do
            read -p "Do you want to install ${C_FORE_BLUE}$name${C_RESET}? [y/${C_BOLD}n${C_RESET}/h]: " install
            if [ "$install" == "y" ]; then
                if [ "$useCask" == "1" ]; then
                    toInstallCask+=( ${app[@]} )
                else
                    toinstall+=( ${app[@]} )
                fi
            elif [ "$install" == "h" ]; then
                open "$url"
            fi
        done
    }
}

function checkInstall() {
    app=$1; name=$2; url=$3
    type -P $app &> /dev/null
    promptToInstall "$name" "$url" "0" "$app"
}

function checkSubCommand() {
    app=$1; subcommand=$2; name=$3; url=$4
    command -v $subcommand &> /dev/null
    promptToInstall "$name" "$url" "0" "$app"
}

function checkCask() {
    cask=$1; name=$2; app=$3; url=$4
    test -d "/Applications/$app"
    promptToInstall "$name" "$url" "1" "$cask"
}

function checkLibraryCask() {
    cask=$1; name=$2; app=$3; url=$4
    test -d "${HOME}/Library/$app"
    promptToInstall "$name" "$url" "1" "$cask"
}

function checkJava() {
    name=$1; version=$2; url=$3
    cask=("oracle-jdk" "oracle-jdk-javadoc")
    /usr/libexec/java_home -v $version &> /dev/null
    promptToInstall "$name" "$url" "1" "${cask[@]}"
}

function checkNvm() {
    app=$1; name=$2; url=$3
    test -d "$HOME/.nvm"
    promptToInstall "$name" "$url" "0" "$app"
}

function checkFile() {
    app=$1; file=$2; name=$3; url=$4
	test -f "$file"
	promptToInstall "$name" "$url" "0" "$app"
}

function installFonts() {
    e_bold "Installing Fonts"
    mkdir -p "${HOME}/Library/Fonts"
    find ./fonts -iname "*.ttf" -exec bash -c '
        source ./bin/utils.sh
        file=`basename {}`
        test -f ${HOME}/Library/Fonts/$file || {
            cp -av {} ${HOME}/Library/Fonts && e_success "Installed $file" || e_error "Unable to install $file"
        } ' \;
}

e_header "Mac Application Installer"

if [[ $xcode -eq 1 ]]; then
    initXCode
fi
if [[ $fonts -eq 1 ]]; then
    installFonts
fi

if [[ $packages -eq 1 ]]; then

e_bold "Installing Programs"

# Command Line Tools
checkInstall brew "Homebrew" "https://brew.sh/"
checkInstall rvm "Ruby Version Manager (rvm)" "https://rvm.io/"

# Homebrew Bottles
checkSubCommand coreutils gecho "Core Utilities" "https://www.gnu.org/software/coreutils"
checkSubCommand moreutils sponge "MoreUtils" "https://joeyh.name/code/moreutils/"
checkSubCommand findutils gfind "FindUtils" "https://www.gnu.org/software/findutils/"
checkSubCommand gnu-sed gsed "GNU sed" "https://www.gnu.org/software/sed/"
checkSubCommand grep ggrep "grep" "https://www.gnu.org/software/grep/"
checkSubCommand openssh scp "OpenSSH" "https://www.openssh.com/"
checkSubCommand gnupg gpg "GNU Pretty Good Privacy" "https://gnupg.org/"
checkSubCommand imagemagick magick "ImageMagick" "https://www.imagemagick.org/"
checkNvm nvm "nvm" "https://github.com/nvm-sh/nvm"
checkInstall automake "AutoMake" "https://www.gnu.org/software/automake/"
checkInstall autoconf "AutoConf" "https://www.gnu.org/software/autoconf"
checkInstall git "Git" "https://git-scm.com/"
checkInstall wget "Wget" "https://www.gnu.org/software/wget/"
checkInstall node "Node.js" "https://nodejs.org/en/"
checkInstall mysql "MySQL" "https://www.mysql.com/"
checkInstall sqlite3 "SQLite" "https://www.sqlite.org/"
checkInstall magick "ImageMagick" "https://imagemagick.org/"
checkInstall cowsay "CowSay" "https://github.com/tnalpgge/rank-amateur-cowsay"
checkInstall tree "Tree" "http://mama.indstate.edu/users/ice/tree/"
checkInstall rsync "rsync" "https://rsync.samba.org/"
checkInstall kotlin "kotlin" "https://kotlinlang.org/"
checkInstall python3 "python3" "https://www.python.org/"
checkInstall jupyter "jupyter" "https://jupyter.org/"
checkFile bash-completion "/usr/local/etc/profile.d/bash_completion.sh" "Bash Completion" "https://salsa.debian.org/debian/bash-completion"

# Homebrew Casks
checkCask android-studio "Android Studio" "Android Studio.app" "https://developer.android.com/studio"
checkCask atom "Atom" "Atom.app" "https://atom.io/"
checkCask balenaetcher "balena Etcher" "balenaEtcher.app" "https://www.balena.io/etcher/"
checkCask coteditor "CotEditor" "CotEditor.app" "https://coteditor.com/"
checkCask cpuinfo "CPU Info" "cpuinfo.app" "https://github.com/yusukeshibata/cpuinfo/"
checkCask db-browser-for-sqlite "DB Browser for SQLite" "DB Browser for SQLite.app" "https://sqlitebrowser.org/"
checkCask diffmerge "DiffMerge" "DiffMerge.app" "https://sourcegear.com/diffmerge/"
checkCask docker "Docker" "Docker.app" "https://www.docker.com/products/docker-desktop"
checkCask dropbox "Dropbox" "Dropbox.app" "https://www.dropbox.com/"
checkCask firefox "Firefox" "Firefox.app" "https://www.mozilla.org/en-US/exp/firefox/"
checkCask gimp "Gimp" "GIMP-2.10.app" "https://www.gimp.org/"
checkCask google-chrome "Google Chrome" "Google Chrome.app" "https://www.google.com/chrome/"
checkCask fork "Git-Fork" "Fork.app" "https://git-fork.com/"
checkCask inkscape "Inkscape" "Inkscape.app" "https://inkscape.org/"
checkCask iterm2 "iTerm2" "iTerm.app" "https://www.iterm2.com/"
checkCask macdown "MacDown" "MacDown.app" "https://macdown.uranusjr.com/"
checkCask macvim "MacVim" "MacVim.app" "https://github.com/macvim-dev/macvim"
checkCask openinterminal-lite "OpenInTerminal Lite" "OpenInTerminal-Lite.app" "https://github.com/Ji4n1ng/OpenInTerminal"
checkCask openineditor-lite "OpenInEditor Lite" "OpenInEditor-Lite.app" "https://github.com/Ji4n1ng/OpenInTerminal"
checkCask postman "Postman" "Postman.app" "https://www.postman.com/"
checkCask powershell "PowerShell Core" "PowerShell.app" "https://microsoft.com/PowerShell"
checkCask projectlibre "Project Libre" "ProjectLibre.app" "https://www.projectlibre.com/"
checkCask pycharm-ce "PyCharm Community Edition" "PyCharm CE.app" "https://www.jetbrains.com/pycharm/"
checkCask scribus "Scribus" "Scribus.app" "https://www.scribus.net/"
checkCask the-unarchiver "The Unarchiver" "The Unarchiver.app" "https://theunarchiver.com/"
checkCask thunderbird "Mozilla Thunderbird" "Thunderbird.app" "https://www.thunderbird.net/en-US/"
checkCask visual-studio-code "Visual Studio Code" "Visual Studio Code.app" "https://code.visualstudio.com/"
checkCask vlc "VLC Media Player" "VLC.app" "https://www.videolan.org/vlc/"
checkCask zoomus "Zoom.us" "zoom.us.app" "https://www.zoom.us/"
checkLibraryCask qlcolorcode "QuickLook CodeFormatter plugin" "QuickLook/QLColorCode.qlgenerator" "https://github.com/anthonygelibert/QLColorCode"
checkLibraryCask qlmarkdown "QuickLook Markdown plugin" "QuickLook/QLMarkdown.qlgenerator" "https://github.com/toland/qlmarkdown"
checkLibraryCask qlprettypatch "QuickLook PrettyPatch plugin" "QuickLook/QLPrettyPatch.qlgenerator" "https://github.com/anthonygelibert/QLColorCode"
checkLibraryCask qlstephen "QuickLook Extensionless plugin" "QuickLook/QLStephen.qlgenerator" "https://github.com/whomwah/qlstephen"
checkLibraryCask quicklook-csv "QuickLook CSV plugin" "QuickLook/QuickLookCSV.qlgenerator" "https://github.com/p2/quicklook-csv"
checkLibraryCask quicklook-json "QuickLook JSON plugin" "QuickLook/QuickLookJSON.qlgenerator" "http://www.sagtau.com/quicklookjson.html"
checkLibraryCask webpquicklook "QuickLook WebP plugin" "QuickLook/WebpQuickLook.qlgenerator" "https://github.com/emin/WebPQuickLook"

checkJava "Oracle JDK" "1.8" "https://www.oracle.com/technetwork/java/javase/overview/index.html"

echo "Those software will be installed: ${toinstall[@]} ${toInstallCask[@]}";
read -p "Let's do it now? [y/${C_BOLD}n${C_RESET}]: " install
if [ "$install" != "y" ]; then
    e_bold "Install cancelled."
    exit 1
fi

# Install the Command Line Tools and the Homebrew Bottles
for i in "${toinstall[@]}"
do
    e_bold "Installing ${C_FORE_BLUE}$i"
    if [ "$i" == "brew" ]; then
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
        brew doctor
        brew update
        brew upgrade
    elif [ "$i" == "rvm" ]; then
        curl -sSL https://get.rvm.io | bash -s stable --ruby --rails
        gem install bundler -v '=1.17.3'
        rvm docs generate-ri
    elif [ "$i" == "nvm" ]; then
        /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh)"
    else
        brew install $i
    fi
done

# Install the Homebrew Casks
for i in "${toInstallCask[@]}"
do
    e_bold "Installing ${C_FORE_BLUE}$i"
    brew cask install $i
done

# Add NPM Packages
# e_bold "Configuring ${C_FORE_BLUE}npm"
# npm install http-server

# Configure OpenInTerminal and OpenInEditor
if [ -d "/Applications/OpenInEditor-Lite.app" ]; then
    e_bold "Configuring ${C_FORE_BLUE}OpenInEditor Lite"
    if [ -d "/Applications/MacVim.app" ]; then
        defaults write wang.jianing.app.OpenInEditor-Lite OIT_EditorBundleIdentifier MacVim
    elif [ -d "/Applications/Visual Studio Code.app" ]; then
        defaults write wang.jianing.app.OpenInEditor-Lite OIT_EditorBundleIdentifier VSCode
    elif [ -d "/Applications/CotEditor.app" ]; then
        defaults write wang.jianing.app.OpenInEditor-Lite OIT_EditorBundleIdentifier CotEditor
    fi
fi
if [ -d "/Applications/OpenInTerminal-Lite.app" ]; then
    e_bold "Configuring ${C_FORE_BLUE}OpenInTerminal Lite"
    if [ -d "/Applications/iTerm.app" ]; then
        defaults write wang.jianing.app.OpenInTerminal-Lite OIT_TerminalBundleIdentifier iTerm
        defaults write com.googlecode.iterm2 OpenFileInNewWindows -bool false
    else
        defaults write wang.jianing.app.OpenInTerminal-Lite OIT_TerminalBundleIdentifier Terminal
    fi
fi

fi # if [[ $packages ]]

if [[ $macdefaults -eq 1 ]]; then

# Configure Mac Appearance
e_bold "Configuring ${C_FORE_BLUE}Mac Appearance"
osascript -e 'tell application "System Preferences" to quit'
osascript << EOF
tell application "System Preferences"
    reveal anchor "Main" of pane id "com.apple.preference.general"
    activate
end tell
EOF

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

# Disable automatic capitalization as it's annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false

# Disable smart dashes as they're annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false

# Disable automatic period substitution as it's annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false

# Disable smart quotes as they're annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false

# Disable auto-correct as it's annoying when typing code
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

# Disable "natural" (Lion-style) scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"

# Show the ~/Library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library &> /dev/null

# Finder: use list view in all windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"

# Show hidden files in Finder
defaults write com.apple.Finder AppleShowAllFiles -bool true
killall Finder

fi # if [[ $macdefaults ]]

if [[ $packages -eq 1 ]]; then
    if [ -d "/Applications/iTerm.app" ]; then
        e_bold "Configuring ${C_FORE_BLUE}iTerm2"
        /bin/bash -c "$(curl -fsSL https://iterm2.com/shell_integration/install_shell_integration.sh)"
        open one-dark.itermcolors
    fi

    # Open instruction pages for manual post-install work
    if [ -d "/Applications/OpenInTerminal-Lite.app" -o -d "/Applications/OpenInEditor-Lite.app" ]; then
        open "https://github.com/Ji4n1ng/OpenInTerminal/blob/master/Resources/README-Lite.md"
    fi
fi