Quick helper to translate tif to tiles using parallel cpu.
$ tif_to_tiles.sh input.tif
gdalwarp will convert to output.tif, gdal2tiles_parallel.py will ingest output.tif and output PNGs to map_tiles folder.
| // getComponent is a function that returns a promise for a component | |
| // It will not be called until the first mount | |
| function asyncComponent(getComponent) { | |
| return class AsyncComponent extends React.Component { | |
| static Component = null; | |
| state = { Component: AsyncComponent.Component }; | |
| componentWillMount() { | |
| if (!this.state.Component) { | |
| getComponent().then(Component => { |
| #!/usr/bin/env ruby | |
| require 'selenium-webdriver' | |
| wd = Selenium::WebDriver.for :remote, url: 'http://10.3.1.7:4444/wd/hub', desired_capabilities: :chrome | |
| wd.navigate.to 'https://snipt.net/restrada/python-selenium-workaround-for-full-page-screenshot-using-chromedriver-2x/' | |
| # Get the actual page dimensions using javascript | |
| # | |
| width = wd.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);") |
| <?php | |
| /** | |
| * Convert a comma separated file into an associated array. | |
| * The first row should contain the array keys. | |
| * | |
| * Example: | |
| * | |
| * @param string $filename Path to the CSV file | |
| * @param string $delimiter The separator used in the file | |
| * @return array |
| docker stop $(docker ps -a -q) | |
| docker rm $(docker ps -a -q) |
| # squash integer | |
| function squash() { | |
| git rebase -i HEAD~${1} | |
| } |
| 'use strict'; | |
| import Crawler from "simplecrawler"; | |
| import fs from 'fs'; | |
| Crawler.crawl("http://www.google.com").on("fetchcomplete", (queueItem, responseBuffer, response) => { | |
| console.log("Completed fetching resource:", queueItem.url); | |
| if (queueItem.url.indexOf('png') > 0 || queueItem.url.indexOf('jpg') > 0 || queueItem.url.indexOf('gif') > 0 || queueItem.url.indexOf('jpeg') > 0) { | |
| let filename = queueItem.url.substring(queueItem.url.lastIndexOf('/')+1); |
| 'use strict'; | |
| import dns from "dns"; | |
| import sys from "sys"; | |
| import fs from "fs"; | |
| const items = JSON.parse(fs.readFileSync('./shake.json')); | |
| function checkAvailable(name, callback) { | |
| dns.resolve4( name, (err, addresses) => { |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| var month= ["January","February","March","April","May","June","July", | |
| "August","September","October","November","December"]; | |
| var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul","Aug", "Sep", "Oct", "Nov", "Dec"]; | |
| //used with date.getMonth() |