Is there a *nix tool (or vim plug-in) that would allow me to automatically format django html template files? Hitting the space bar hundreds of time does not sound like a good use of my time but then neither does leaving some weird formatting that is hard to read. Answer Install vim-jinja2-syntax plugin by putting Glench/Vim-Jinja2-Syntax when installing it with
How to use Arduino-Makefile with Sparkfun Pro Micro?
So, I am using Arduino-Makefile (https://github.com/sudar/Arduino-Makefile) and trying to program a 5V 16MHz Sparkfun Pro Micro (https://www.sparkfun.com/products/12640). I am using the versions of the Arduino libraries and Arduino-Makefile in the repository of the Linux distro I am using (Linux Mint 17.2). These versions are 1.0.5 and 1.3.1 respectively. My file structure looks like this: My test.ino is taken directly from
Get Subnet mask in Linux using bash
I am using bash to get the IP address of my machine with that script: And now I am trying to get the Subnet Mask in this type: But I have no idea how can I do that. Answer there are couple of ways to achieve this: first: to print the mask in format 255.255.255.0, you can use this: second:
What is the fastest way to increase the size of a file in linux on a ext4 filesystem from a C executable without creating holes in the file?
The fastest way to increase the file size that I know of would be to ftruncate() or lseek() to the desired size and write a single byte. That doesn’t fit my needs in this case because the resulting hole in the file doesn’t reserve space in the file system. Is the best alternative to use calloc() and write()? Perhaps this
How do symlinks in a host volume work in Docker containers?
My question is about what happens when you create a symlink from inside a container in a host mounted directory. It’s easiest if I just ask with an example. Assume we start a container like so. Most of the command doesn’t matter, what’s important here is the host volume mount. While in the container I create a symlink in the
How to feed awk input from both pipe and file?
I was wondering how do I get awk to take a string from the pipe output and a file? I’ve basically have a chain of commands that eventually will spit out a string. I want to check this string against a csv file (columns separated by commas). Then, I want to find the first row in the file that contains
Using cut to remove until a delimiter from end
I have a string with many delimiters like : abcd – efgh – foobar.extension (Delimiter ‘-‘) I want to remove the So far, I have done But this does not help as it echo’s I want to be able to keep the inital part before the final delimiter(‘-‘) is found. Answer In bash you can use this built-in string manipulation:
Circular SSH Tunnel
Is is possible to create a circular SSH Tunnel? local1 >SSH_TUNNEL> remote1 >SSH_TUNNEL> local1 On “Remote1” I create a TAR that I want to pipe to STDOUT ( – ) … can I then TAR – . | >SSH_TUNNEL> local1 ssh user@remote1 “tar -cvf – . | ssh user@local1” I’ve googled and forum’d and googled some more … I can’t
Combining two bash commands
If found this code which gives pi Ip address and this which sends 1.2.3.4 off to dweet.io stream How can I get the output from 1st to replace the 1.2.3.4 in second please? Answer Save the output of the first command in a variable: Btw, if your raspberrypi is running raspbian, then a much cleaner way to get the IP
what is the difference between uio.h and io.h?
Sometimes I see compiler complaining about this line with fatal error: sys/io.h: No such file or directory If I simply change it to It will magically work. Can someone explain to me the difference? Why do some OSes have one but not the other? Edit: This issue happens on a Linux, not just OS X. Answer Generally speaking, it is