This post reviews several methods for converting a Markdown (.md) formatted file to PDF, from UNIX or Linux machines.
$ pandoc How_I_got_svg-resizer_working_on_Mac_OSX.md -s -o test1.pdf
<?php | |
function escapetext($text) { | |
return str_replace("\n", "<br>", htmlentities($text)); | |
} | |
function exec_command($cmd, $internal = false) { | |
try { | |
$shell_exec = shell_exec($cmd); | |
} catch (Exception $e) { |
# Writing to a file in Python | |
# This was tested on Python 2.7. | |
# path - is a string to desired path location. The file does | |
# not have to exist. | |
# content - is a string with the file content. | |
def writeToFile(path, content): | |
file = open(path, "w") | |
file.write(content) | |
file.close() |
# Chroot Jail for SSH Access | |
# Tested on Ubuntu 14.04.2 LTS and Debian GNU/Linux 8 (jessie) | |
# Reference : http://allanfeid.com/content/creating-chroot-jail-ssh-access | |
# | |
# Had to add/change several things to make it work, including: | |
# - create lib64 folder | |
# - copy whoami dependencies that ldd doesn't show to fix 'I have no name!' | |
# in the customized prompt + create passwd file | |
# |
$ wp post list --format=ids | xargs wp post update --comment_status=closed | |
# Output: | |
# Success: Updated post 2514. | |
# Success: Updated post 2511. | |
# Success: Updated post 2504. | |
# Success: Updated post 2499. | |
# Success: Updated post 2441. | |
# etc... |
#!/bin/bash | |
# | |
# Example using getopt (vs builtin getopts) that can also handle long options. | |
# Another clean example can be found at: | |
# http://www.bahmanm.com/blogs/command-line-options-how-to-parse-in-bash-using-getopt | |
# | |
aflag=n | |
bflag=n |
# <SRCUSER> <SRCPW> <DSTUSER> <DSTPW> |
#!/bin/bash | |
###################################################################### | |
#This is an example of using getopts in Bash. It also contains some | |
#other bits of code I find useful. | |
#Author: Linerd | |
#Website: http://tuxtweaks.com/ | |
#Copyright 2014 | |
#License: Creative Commons Attribution-ShareAlike 4.0 | |
#http://creativecommons.org/licenses/by-sa/4.0/legalcode |
alias editbash='vim ~/.bashrc' | |
alias updatebash='source ~/.bashrc' | |
alias ls='ls -alC --color=auto' | |
function search (){ | |
egrep -roiI $1 . | sort | uniq | |
} | |
function whereis (){ | |
find . -name "$1*"; |
#!/bin/bash | |
IPADDR="" | |
if [ -f /usr/bin/ec2metadata ] | |
then | |
IPADDR=`timeout 1 ec2metadata --public-hostname` | |
fi | |
if [ "$IPADDR" = "" ] | |
then |