Skip to content

Instantly share code, notes, and snippets.

@sfelde
sfelde / static-page
Created December 3, 2017 21:43
static-page
wget -P ./static -mpck --user-agent="" -e robots=off --wait 1 -E http://www.page.de/
@sfelde
sfelde / wget
Created September 29, 2017 18:08 — forked from jasperf/wget
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@sfelde
sfelde / nginx.conf
Created November 13, 2016 13:01 — forked from Stanback/nginx.conf
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender).Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
# Note (November 2016):
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
@sfelde
sfelde / gist:1aeac7937abda27248b926222425fed1
Created August 22, 2016 15:33 — forked from mikhailov/gist:9639593
Nginx S3/Unicorn Proxy with backend keep alive
# The Nginx configuration based on https://coderwall.com/p/rlguog
http {
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 15m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
@sfelde
sfelde / kiev-map-example.json
Created March 11, 2016 19:47
kiev-map-example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@sfelde
sfelde / redmine api with http auth
Created November 18, 2014 16:01
redmine api with http auth
$ curl -H "User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" http://username:password@domain.ltd/issues.json?key=f68d6496f1bd00767f5asdfa3er23reqecc0d1dd7a0676ac9f2964&limit=100&status_id=3&project_id=8
// Blueleaf API Integration with Google Spreadsheet using Google Scripts to build
// custom spreadsheet functions to retrieve (query only) account data from Blueleaf.
//
// This script code is provided AS IS for demonstration purposes; no warranty of its
// robustness nor any guarantee it will work in your Google Apps environment is
// provided -- Jim Koch 2014
//
// When debugging, use the Logger function below to check the data fields available
// from Blueleaf.
//

Prolog

Google Chrome Developers says:

The new WOFF 2.0 Web Font compression format offers a 30% average gain over WOFF 1.0 (up to 50%+ in some cases). WOFF 2.0 will be available from Chrome M36 (beta) and there on.

TTF to WOFF2 converting

I have installed Googles compression library on a DigitalOcean (ref) server. Feel free to start the convert from TTF to WOFF2. No software installation required. Simply use your terminal window. Web developers, make your life easier and webpages faster!