Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
export function flatMap<T, U>(array: T[], callbackfn: (value: T, index: number, array: T[]) => U[]): U[] { | |
return Array.prototype.concat(...array.map(callbackfn)); | |
} |
// npm install twit | |
const Twit = require("twit"); | |
// Fill this in | |
const T = new Twit({ | |
consumer_key: "???", | |
consumer_secret: "???", | |
access_token: "???", | |
access_token_secret: "???" | |
}); |
#standardsql | |
WITH a AS ( | |
SELECT * FROM UNNEST([1,2,3,4]) AS n | |
), b AS ( | |
SELECT * FROM UNNEST([4,5,6,7]) AS n) | |
SELECT * FROM a |
#!/usr/bin/env python3 | |
import os | |
import logging | |
import psycopg2 as pg | |
from decimal import Decimal | |
from functools import wraps | |
from psycopg2.pool import ThreadedConnectionPool |
<?xml version="1.0" encoding="UTF-8"?> | |
<protocol name="global_input_v1"> | |
<copyright> | |
Copyright (C) 2017 Val Packett ([email protected]) | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
#!/bin/bash | |
# | |
# open-in-firefox.sh - open URL from Termux command line in Firefox Android browser | |
# | |
# Works with file:// URLs too, unlike with termux-open{-url}. | |
# | |
exec am start --user 0 -a android.intent.action.VIEW -n org.mozilla.firefox/.App -d "$1" >/dev/null |
function fieldSorterOptimized(fields) { | |
var dir = [], i, l = fields.length; | |
fields = fields.map(function(o, i) { | |
if (o[0] === "-") { | |
dir[i] = -1; | |
o = o.substring(1); | |
} else { | |
dir[i] = 1; | |
} | |
return o; |
To create a new Device ID (and reset configuration) after cloning a VM with Syncthing, just remove the content of this folder: | |
- Unix-like: $HOME/.config/syncthing | |
- Mac: $HOME/Library/Application Support/Syncthing | |
- Windows XP: %AppData%/Syncthing | |
- Windows 7+: %LocalAppData%/Syncthing |
# -*- coding: utf-8 -*- | |
import scrapy | |
import re | |
import unicodedata | |
from scrapy.crawler import CrawlerProcess | |
from urllib.parse import urlparse | |
class WikiSpider(scrapy.Spider): | |
name = 'wiki_company' |