Change mysql collation from latin* to utf8 can be done by simply stop being a lazy bastard and, take the time to change the default mysql collation for the new databases you create… But what can I say, I’m a lazy bastard after all. I keep doing the same mistake over and over again. Just […]
Batch Watermark photos with imageMagick script
ImageMagick is an awesome image manipulation tool. It provides an command-line API for literally hundreds of functionalities related to image editing. Every now and then I need to apply watermarks to my images before posting them somewhere online, in public. GIMP, has one or two scripts which extend its functionalities but there’s no neat way […]
Observium – Rename existing devices
In case you have a lot of devices monitored by observium and for a reason (a hypervisor migration maybe?) you need to change servers’ hostnames, observium, at the time being, doesn’t seem to support renaming via its web interface but you can successfully do it from the command-line. Read the instructions below. Change current directory […]
ssh refused: sshd[2444]: userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes [preauth]
If you just upgraded Ubuntu 15.04/10 to Ubuntu 16.04 LTS (or otherwise upgraded OpenSSH from v6.9 to v7.0 you may be getting the ssh refusal because of changes in OpenSSH. I was specifically getting this error in the /var/log/auth.log (via Webmin): sshd[2444]: userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes [preauth]. For this specific error, you […]
Fix nethogs ‘creating socket failed while establishing local IP’
As it’s not available in repo nor PPA you need to build it (it is really easy and quickly done). Fetch and extract
1 2 3 4 |
wget -c https://github.com/raboof/nethogs/archive/v0.8.1.tar.gz tar xf v0.8.1.tar.gz cd ./nethogs-0.8.1/ |
Install dependencies and build
1 2 3 |
sudo apt-get install libncurses5-dev libpcap-dev make && sudo make install |
Check and run
1 2 |
nethogs -V sudo nethogs |
Source
Handlebars ifequal helper
Handlebars.js {{#if}} helper lacks of equality condition. In cases where some logic should be put inside the template, some folks prefer to override it. But instead of overriding {{#if}} helper, and taking my chances to break previous/older handlebars templates in my projects, I’m always about to use my custom helper {{#ifequal}}.
1 2 3 4 5 6 7 8 |
Handlebars.registerHelper('ifequal',function(conditional,options) { if (options.hash.value === conditional) { return options.fn(this); } else { return options.inverse(this); } }); |
Usage
1 2 3 4 5 6 7 |
type = "password"; {{#ifequal type value="password"}} <input type="password"> {{else}} <input type="text"> {{/ifequal}} |
Create a permanent swap file equal to RAM bytes
Create a permanent swap file equal to RAM bytes. Yeah I know this is the lazy admin talking, but the inside wants out …
Swap file on! Only when you need it…
So here’s a quick snippet to turn on swap on a file, even after OS installation, temporarily. At line one notice the file size is 4G . Modify it to your needs.
Boostnote is the new kickass note taking app for programmers
Boostnote is an open-source note taking app especially designed for programmers. Build up with Electron framework, previously known as atom shell – atom’s editor engine, make it the ultimate free and open-source cross-platform kickass note app for developers! Your notes will be written in markdown and instantly saved, while Boostnote will make sure your source […]
Sublime Text 2/3 run shell commands On Save #sublimetext
Sublime Text editor is my favorite along with atom. Have you ever really wanted to run a shell command whenever you save a file in Sublime? Like, automatically commit the changes on a github repo or rsync files to a debug server or start a service like php‘s built-in web server? How about all of them together, […]