See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
server { | |
listen 80; | |
server_name _; | |
root /var/www/html; | |
index index.php; | |
set $skip_cache 0; | |
# POST requests and urls with a query string should always go to PHP |
version: "3" | |
networks: | |
kong-net: | |
driver: bridge | |
services: | |
####################################### | |
# Postgres: The database used by Kong |
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
package main | |
import ( | |
"net/http" | |
"log" | |
) | |
func redirect(w http.ResponseWriter, req *http.Request) { | |
// remove/add not default ports from req.Host | |
target := "https://" + req.Host + req.URL.Path | |
if len(req.URL.RawQuery) > 0 { |
import org.apache.commons.httpclient.ConnectTimeoutException; | |
import org.apache.commons.httpclient.params.HttpConnectionParams; | |
import org.apache.commons.httpclient.protocol.Protocol; | |
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; | |
import org.apache.commons.httpclient.protocol.ReflectionSocketFactory; | |
import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import sun.security.ssl.SSLSocketImpl; |
###While this script does concatenate pdf files, I haven't yet figured out in which order it does so. On a sample of 19 pdf files, logically named 01something.pdf, 02something.pdf, 03something.pdf, etc. the order of the merged product seemed almost random...
...from Tiger onwards, OSX ships with a Python script that concatenates pdf files (merges them together). The script is already executable, and Python is pre-installed on OS X, so all you need to do is point it at your pdf files and run
"/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o PATH/TO/YOUR/MERGED/FILE.pdf /PATH/TO/ORIGINAL/1.pdf /PATH/TO/ANOTHER/2.pdf /PATH/TO/A/WHOLE/DIR/*.pdf
I prefer putting the link in /usr/local/bin, as it is in the $PATH and therefore I can run the command from anywhere. To set up the link, you need to navigate to the directory where you want the link.
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.nio.channels.FileLock; | |
// The class demonstrates how to get an exclusive file lock that prevents other threads and processes / JVMs from | |
// obtaining a lock on the same file. To do this, you need to synchronize a block on a file and acquire FileLock. See | |
// comments below for more details. Run this class in multiple JVMs and see each thread of each JVM acquires a lock in | |
// an orderly fasion. | |
public class FileLocking extends Thread |
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect | |
# [email protected] - http://jeroen.massar.ch | |
server { | |
listen 192.0.1.1:80; | |
listen [2001:db8::1]:80; | |
# Redirect all non-HTTPS traffic to the HTTPS variant | |
return 301 https://$host$request_uri; | |
} |
package net.viralpatel.servlets; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; |