GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.
| /** | |
| * Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers | |
| * @author ShirtlessKirk. Copyright (c) 2012. | |
| * @license WTFPL (http://www.wtfpl.net/txt/copying) | |
| */ | |
| var luhnChk = (function (arr) { | |
| return function (ccNum) { | |
| var | |
| len = ccNum.length, | |
| bit = 1, |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| 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; |
| # Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect | |
| # jeroen@massar.ch - 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; | |
| } |
| 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 |
###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/*.pdfI 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 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; |
| 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 { |
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