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
# -*- coding: utf-8 -*- | |
import json | |
import sys | |
from ConfigParser import (ConfigParser, MissingSectionHeaderError, | |
ParsingError, DEFAULTSECT) | |
class StrictConfigParser(ConfigParser): | |
def _read(self, fp, fpname): |
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
// import json array file to elasticsearch | |
const fs = require('fs') | |
const shelljs = require('shelljs') | |
let endpoint = process.argv[2] | |
let jsonFile = process.argv[3] | |
if (!endpoint || !jsonFile || endpoint.search('_bulk') === -1) { | |
console.log('sample: node jsonArrayToES.js localhost:9200/bank/customer/_bulk customer.json') | |
process.exit() | |
} |
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
import android.os.Build; | |
import java.lang.reflect.Method; | |
public class Device { | |
/** | |
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status | |
* > Serial number}, or {@code null} if the serial number couldn't be found | |
*/ | |
public static String getSerialNumber() { |
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
var stringToColor = function(str) { | |
var hash = 0; | |
for (var i = 0; i < str.length; i++) { | |
hash = str.charCodeAt(i) + ((hash << 5) - hash); | |
} | |
var color = '#'; | |
for (var i = 0; i < 3; i++) { | |
var value = (hash >> (i * 8)) & 0xFF; | |
color += ('00' + value.toString(16)).substr(-2); | |
} |
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
package com.polysfactory.DrmFrameworkTest; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import android.app.Activity; | |
import android.drm.DrmManagerClient; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.widget.TextView; |
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
import android.content.Context; | |
import android.net.ConnectivityManager; | |
import android.net.NetworkInfo; | |
import android.os.Build; | |
import android.telephony.PhoneStateListener; | |
import android.telephony.TelephonyManager; | |
import permissions.dispatcher.PermissionUtils; | |
/* |
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
package jp.sumasu.test; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.telephony.PhoneStateListener; | |
import android.telephony.SignalStrength; | |
import android.telephony.TelephonyManager; | |
import android.widget.TextView; |
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
// ==UserScript== | |
// @name Generic Key Listener | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description logs key events. useful for creating a script you want actived on a set of keys | |
// @author Petalousa | |
// @include * | |
// @grant none | |
// ==/UserScript== |
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
// ==UserScript== | |
// @name Google digits | |
// @include https://www.google.tld/* | |
// @run-at document-start | |
// ==/UserScript== | |
// only work on search pages with #q= &q= ?q= | |
if (location.href.match(/[#&?]q=/)) { | |
window.addEventListener('keydown', function(e) { | |
var digit = e.keyCode - 48; |
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
# Center Crop and Image Scaling functions in OpenCV | |
# Date: 11/10/2020 | |
# Written by Nandan M | |
import cv2 | |
def center_crop(img, dim): | |
"""Returns center cropped image | |
Args: |
OlderNewer