I'm using svnnotify to send notification email upon commits. I have the following script on my repo's hooks/post-commit:
#!/bin/sh
REPOS="$1"
REV="$2"
for address in $(/bin/cat /var/svn/teachbyapp/hooks/addressee.list)
do
/usr/local/bin/svnnotify \
-r $REV \
-C \
-d \
--diff-encoding utf8 \
-H HTML::ColorDiff \
-p $REPOS \
-t "$address" \
--from svn#factory.e-levelcom.com
done
It works but all I get is balck and white diff (no colors at all).
Added lines are underlined whereas removed lines have strike-through format. Nothing else, no color at all.
How can I get actually colored diff? Something like this
Ok I found it.
Thanks to this work
Also needed to append --css-inline option to svnnotify command in my script
Related
I am using Gitbash, GNU bash, version 4.3.46(2)-release (x86_64-pc-msys).
I am running a bash script that looks like this
CODE CHUNK 1
curl -i -X POST \
-H "Content-Type:application/json" \
-H "x-customheader:customstuff" \
-d \
'{
Gigantic json payload contents in here
}' \
'http://localhost:5000/api/123'
This works fine. Basically it posts a giant payload to an endpoint and all is well. The problem is when I attempt to substitute the url for a value from a variable, I get a curl error,
curl: (1) Protocol "'http" not supported or disabled in libcurl
CODE CHUNK 2
stuff=\'http://localhost:5000/api/123\'
curl -i -X POST \
-H "Content-Type:application/json" \
-H "x-customheader:customstuff" \
-d \
'{
Gigantic json payload contents in here
}' \
$stuff
If I echo $stuff immediately after the stuff=\'http://localhost:5000/api/123\', I get 'http://localhost:5000/api/123'. This is the same value as I had hard-coded in code chunk 1, single ticks and all. There is something hiding behind the scenes in how that url is being evaluated after the variable has been expanded. I need to get the same behavior as a hard coded url.
Look closely at this error message:
curl: (1) Protocol "'http" not supported or disabled in libcurl
Notice the single-quote in front of http.
The curl command surely knows the http protocol, but not the 'http protocol!
The way you wrote it, the single-quotes are part of the value of stuff:
stuff=\'http://localhost:5000/api/123\'
Remove those, write like this:
stuff='http://localhost:5000/api/123'
If you have variables inside your real string,
and you want them expanded, then use double-quotes instead of single-quotes:
stuff="http://localhost:5000/api/123"
Equally important,
when you use $stuff as a parameter of curl,
you must double-quote it.
If you just write curl $stuff,
then the shell may interpret some characters in $stuff before passing to curl.
To protect from that,
you must write curl "$stuff".
The complete command:
curl -i -X POST \
-H "Content-Type:application/json" \
-H "x-customheader:customstuff" \
-d \
'{
Gigantic json payload contents in here
}' \
"$stuff"
Finally, make sure that after each \ at the end of lines,
there's nothing after the \ on each line,
the \ must be at the very end.
Why do you define stuff with the ' ' ?
Try it like that:
stuff="http://localhost:5000/api/123"
curl -i -X POST \
-H "Content-Type:application/json" \
-H "x-customheader:customstuff" \
-d \
'{
Gigantic json payload contents in here
}' \
"$stuff"
Also, don't put variables in single quotes, because bash is not available to understand them.
stuff="http://localhost:5000/api/123"
echo "$stuff"
>> http://localhost:5000/api/123
echo '$stuff'
>> $stuff
I am trying to make a topojson file with csv data embedded using a makefile. I am using Mike Bostock's us-atlas as a guide.
topo/us-counties-10m-ungrouped.json: shp/us/counties.shp
mkdir -p $(dir $#)
topojson \
-o us_counties.json \
--no-pre-quantization \
--post-quantization=1e6 \
--external-properties=output.csv \
--id-property=FIPS \
--properties="County=County" \
--properties="PerChildrenPos=+PerChildrenPos" \
--simplify=7e-7 \
-- $<
It creates the topojson I need but completely ignores the output.csv file.
Here is a glimpse at what it returns.
{"type":"Polygon","id":"53051","properties":{"code":"53051"},"arcs":[[-22,79,80,-75,81]]}
Here's what I need it to return.
{"type":"Polygon","id":"53051","properties":{"code":"53051", "County":"Los Angeles", "PerChildrenPos": 10},"arcs":[[-22,79,80,-75,81]]}
Any ideas why it might be ignoring the csv file, I've tested moving it around to see if perhaps it was unaccessible or something?
Thanks in advance.
According to the documentation here: https://github.com/mbostock/topojson/wiki/Command-Line-Reference#external-properties
(If your CSV file uses a different column name for the feature identifier, you can specify multiple id properties, such as --id-property=+FIPS,+id.)
It seems that you need to change your --id-property=FIPS \ to something that corresponds to your CSV column names.
Also for --properties="County=County" \
I think it should be --properties County=+County \
Same for --properties="PerChildrenPos=+PerChildrenPos" \
Should be --properties PerChildrenPos=+PerChildrenPos \
For --external-properties=output.csv \
it should be --external-properties output.csv \
Basically the parameters do not need to be prefixed by an = sign.
Code
pandoc \
data.tex \
-f markdown \
-t html \
\
| grep -E '(^<|^$|^ *$)' \
\
| grep -v '^<p' \
\
| perl -pe 's#(?<!\\)%.*</#</#' \
\
| pandoc \
-f html \
-o vertical_output.pdf \
--latex-engine=xelatex
which gives tables on vertical layout as output, see the picture below.
Example case where horizontal table is needed
The content of the file data.tex is the following data.
Data.tex:
--------------------------------------------------------------------------------------------------------------------------------------------
Name Description Location Examples Start Peak Duration Appearance
--------------- --------------- -------------- ------------------- ---------------- -------------- --------------- -------------------
Prandial short-acting belly, Lispro (Humalog), 5-10 min before 30-60 minutes 2-4 hours Transparent
analogs abdomen Aspart (Novorapid), meal
= chemically Glulisine (Apidra)
sythesized;
Regular/short human insulin addomen Humulin R 30 min before 60 minutes 6-8 hours, Transparent
not analog meal hypoglycemia
not flexible risk
-------------------------------------------------------------------------------------------------------------------------------------------
Table: Diabetic drugs parndial and basal. Location, start, peak, duration and appearance.
giving by running the above code to the data
Comments
I would like to have a horizontal layout such that the table would be adjusted to it. I do not know to which stage I should affect to have it.
I think it should be possible in the last pandoc -process.
Too much space around sparse tables
One document has many types of tables.
The current accepted answer works well if tables are rather full, but badly with sparse tables.
Using the parameter of the accepted answer -V geometry:"paperwidth=22in, paperheight=210mm, margin=2cm", we get:
where the second table is extended too much; I would like to have it narrower; but not sure if this is possible dynamically in Pandoc.
How can you have a horizontal layout of pandocing?
Whenever you use Pandoc to produce PDF output, you can control the page size of the file with an addition to the command line. For example, generate a page with a width of 22 inches and a height of 210 Millimeters, while keeping each margin at 2 Centimeters, use this Pandoc parameter:
-V geometry:"paperwidth=22in, paperheight=210mm, margin=2cm"
I hope this example makes clear to you how you can influence the output paper size in different other ways.
However, I do not know if it answers your question. Your question is not very clear to me, I must admit.
My answer however may help other people when searching for "horizontal layout pandoc markdown".
Full commands to try
First, 12 inches width:
pandoc \
data.tex \
-f markdown \
-t html \
\
| grep -E '(^<|^$|^ *$)' \
\
| grep -v '^<p' \
\
| perl -pe 's#(?<!\\)%.*</#</#' \
\
| pandoc \
-f html \
-o vertical_output1.pdf \
--latex-engine=xelatex \
-V geometry:"paperwidth=12in, paperheight=80mm, margin=0.5cm"
Second, 14 inches width:
pandoc \
data.tex \
-f markdown \
-t html \
\
| grep -E '(^<|^$|^ *$)' \
\
| grep -v '^<p' \
\
| perl -pe 's#(?<!\\)%.*</#</#' \
\
| pandoc \
-f html \
-o vertical_output1.pdf \
--latex-engine=xelatex \
-V geometry:"paperwidth=14in, paperheight=80mm, margin=0.5cm"
Outputs (as PNG screenshots from the PDFs to make them visible here):
I'm trying to use cURL in a script and get it to not show the progress bar.
I've tried the -s, -silent, -S, and -quiet options, but none of them work.
Here's a typical command I've tried:
curl -s http://google.com > temp.html
I only get the progress bar when pushing it to a file, so curl -s http://google.com doesn't have a progress bar, but curl -s http://google.com > temp.html does.
curl -s http://google.com > temp.html
works for curl version 7.19.5 on Ubuntu 9.10 (no progress bar). But if for some reason that does not work on your platform, you could always redirect stderr to /dev/null:
curl http://google.com 2>/dev/null > temp.html
In curl version 7.22.0 on Ubuntu and 7.24.0 on OSX the solution to not show progress but to show errors is to use both -s (--silent) and -S (--show-error) like so:
curl -sS http://google.com > temp.html
This works for both redirected output > /some/file, piped output | less and outputting directly to the terminal for me.
Update: Since curl 7.67.0 there is a new option --no-progress-meter which does precisely this and nothing else, see clonejo's answer for more details.
I found that with curl 7.18.2 the download progress bar is not hidden with:
curl -s http://google.com > temp.html
but it is with:
curl -ss http://google.com > temp.html
Since curl 7.67.0 (2019-11-06) there is --no-progress-meter, which does exactly this, and nothing else. From the man page:
--no-progress-meter
Option to switch off the progress meter output without muting or
otherwise affecting warning and informational messages like -s,
--silent does.
Note that this is the negated option name documented. You can
thus use --progress-meter to enable the progress meter again.
See also -v, --verbose and -s, --silent. Added in 7.67.0.
It's available in Ubuntu ≥20.04 and Debian ≥11 (Bullseye).
For a bit of history on curl's verbosity options, you can read Daniel Stenberg's blog post.
Not sure why it's doing that. Try -s with the -o option to set the output file instead of >.
this could help..
curl 'http://example.com' > /dev/null
On macOS 10.13.6 (High Sierra), the -sS option works. It is especially useful inside Perl, in a command like curl -sS --get {someURL}, which frankly is a whole lot more simple than any of the LWP or HTTP wrappers, for just getting a website or web page's contents.
I am trying to setup OpenGrok to search through a few GB of code, mostly Java and Python projects. I use opengrok-0.12.1/bin/OpenGrok index $SRC_ROOT to build the index. I can see it indexing Java's "target" and Python's ".tox" directories which I don't need.
I searched online and found the same question in many forums, and the answer being to use -i. I have tried to use this option with both the OpenGrok wrapper script as well as opengrok.jar, but all I get is the help message (because the command line options were apparently wrong).
Could you give me an example command to build indices that ignore certain directories?
The solution is to use the -i flag. The best way to do this is to create a .conf file. For example, I have the following file defined as opengrok.conf:
OPENGROK_APP_SERVER=Tomcat
OPENGROK_TOMCAT_BASE=/usr/local/Cellar/tomcat/8.0.21/libexec
OPENGROK_SCAN_DEPTH=4
OPENGROK_VERBOSE=yes
OPENGROK_PROGRESS=yes
IGNORE_PATTERNS="-i f:foo.txt -i *.bar -i d:target -i d:.tox"
And run the indexing using:
OPENGROK_CONFIGURATION=opengrok.conf ./OpenGrok index $SRC_ROOT
It ignores indexing the file foo.txt, all files that match the pattern *.bar, and all files in directories named target or .tox.
Edit credits: mrenaud, pcas
Note that https://github.com/oracle/opengrok/pull/1841 renamed IGNORE_PATTERNS to OPENGROK_IGNORE_PATTERNS (in Oct 2017).
https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
java -jar opengrok-1.3.16/lib/opengrok.jar --help
-i, --ignore pattern
Ignore matching files (prefixed with 'f:' or no prefix) or directories
(prefixed with 'd:'). Pattern supports wildcards (example: -i '*.so'
-i d:'test*'). Option may be repeated.
with the new opengrok-tools, it looks like
opengrok-indexer \
--java_opts=-Djava.util.logging.config.file=$(OPENGROK_BASE)/etc/logging.properties \
--jar $(OPENGROK_DIST)/lib/opengrok.jar -- \
--ctags /usr/local/bin/ctags \
--source $(PWD) \
--dataRoot $(OPENGROK_BASE)/data \
--progress \
--history \
--assignTags \
--writeConfig $(OPENGROK_BASE)/etc/configuration.xml \
--analyzer .sc:ScalaAnalyzer \
--ignore 'd:zold' \
--ignore 'd:opengrok' \
--ignore 'd:tmp' \
--ignore 'd:.venv' \
--ignore 'd:.ipynb_checkpoints' \
--ignore 'd:.metals' \
# END