[TipJar] Quickly wipe a file in a Linux shell

No Comments

No time to read through contexts? Jump to the TL;DR; section.

There are use cases that require the secure wiping or deletion of files. There are already a lot of available utilities available in most modern distributions such as srm, swipe, etc. These however entail installing an additional package which is fine for work machines. The use case I had is to securely delete a transient file after it was generated and used in a Continuous Integration server. Installing the secure-delete package is trivial but a base Linux system already has the tool that can do the job: dd

More

Locating happiness

No Comments

Happiness is an elusive treasure for most but in reality it is hiding in plain sight.

Happiness is located at the crux of being content with what you have and what you are willing to forego.

Getting more means exerting additional effort and taking on more responsibilities. If those start being a burden then it is a good sign your personal inflection point is already known. The question now becomes “are you ok to maintain this as your status quo, or do you still want to achieve more?”

Two sides of the same coin

No Comments

I prefer training my team using the pavlovian conditioning, with a slight bias in negative reinforcement. This has drawn the ire of the Human Resources department in the past.

The reinforcement that I usually employ is done via penalties. The penalties are monetary in nature, and increases in severity if the infraction happens close to each other. An example is a first violation is worth Php50, but any violation in the next 2 weeks will incur a higher penalty of Php100, and so on until a set limit (normally Php500 per infraction). If there is no violation after 2 weeks then the penalty goes back to Php50 as the next violation will be treated as a first offense. The reinforcement is only effective if the team sees that I have my skin in the game too. If the violation is something that applies to me then the same penalties cover my violations. Usually I also sweeten the pot wherein if there is no violation for 2-3 consecutive periods then I automatically contribute the highest penalty amount to the collected funds. I “lose” either way but my goal is not to collect funds but to make the team learn a certain behavior.

The funds collected do not go to my own pocket. The team decides what to do with it. Normally the team spends it on a lunch-out or a series of snacks. I had one team donate the collected funds to charity.

The whole point of negative reinforcement is to make sure that the subjects do not deviate on the prescribed behavior as it will be too inconvenient. Positive reinforcement on the other hand makes it pleasant to meet the prescribed behavior. I just prefer the former because I find it more effective in getting results in a much shorter time.

ciao!

Hi Dad!

No Comments

I am not a handy man as I never inherited that skill from Daddy. I am very of wary of powertools even if I am fascinated by them. I always treat the tools with respect whenever I use them. Much like today.

I am glad to say the powertool I am using today (portable impact drill) didnt cause me harm. It was the underside of the monoblock chair that did me in and caused a mini red fountain in my  foot’s second toe. It was a perfect storm of carelessness, stupidity and timing.

I did see Daddy again in that brief 30 seconds of pain though. I squealed the same way I imagined he would have. Murmuring self-directed invectives while brimming with pain.

Sync clock with Google

No Comments

If the Linux VM was running at the time the host OS (Windows) hibernated then the clock in the guest VM will be left at the time of hibernation. If NTP is configured then the clock should resync gradually but most systems do not apply a big chunk of time correction by default.

If the Linux VM was configured with a VPN that implements a system-wide configuration then the DNS resolution might be unable to resolve the NTP server since the DNS of the VPN session will be unavailable. The alternate and work-around presented hinges on two things:

  • The guest VM has internet access at the time it was resumed.
  • The google.com domain name is already resolved and cached.

   sync-clock() {
     echo Current time before sync: `date`
     echo Current time after sync : `sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 \ 
       | grep Date: | cut -d' ' -f5-8)Z"`
    }

The work-around uses the time in the google headers to provide an anchor for the correction.  This is provided as a bash function to provide user feedback if a correction was done.

Snippet execution

Older Entries