As we know, new outlook keeps popping up in Windows Mail where you can toggle to use the new Outlook. Which is fucked up! Windows Mail is free, you can use outlook if you have free account but you cannot use Outlook if you purchase basic subscription. So I have no choice but to use Windows Mail because I only got basic subscription.

Somehow, Windows can force install this to your system and even replace the Mail to the new Outlook. I go through to few sites which they have the same problem with me.

But none of them works!!!

So, here's my solution. Open your notepad, write a powershell script, copy the code below...

# power shell

# show list of apps
# Get-AppxPackage | select Name, PackageFullName | Format-List

# remove outlook
Remove-AppxPackage -allusers Microsoft.OutlookForWindows_1.2024.916.0_x64__8wekyb3d8bbwe
Get-AppxPackage -all Microsoft.OutlookForWindows_* | Remove-AppxPackage -AllUsers

then save the file as powershell script at any location you want, example: "D:\uninstall_outlook.ps1"

then open in your Windows Task Scheduler, create a task, schedule it to run every 10 minutes.

or (this is the one I used because Task Scheduler sucks!) download and use System Scheduler at https://www.splinterware.com/download/index.html -- the free version of course! System Scheduler is better doing the task than Windows Task Scheduler.

Do the same, create a task/event then in the Event tab, name the event or task. there fill up the other fields like:

  • Application: powershell.exe
  • Parameters: -File uninstall_outlook.ps1
  • Working Dir: D:\
  • State: Hidden

then go to the next tab, Schedule. Select Every hour / selected Minutes, then select every 5 minutes.

UPDATE 2024-10-14: ensure you run the system scheduler as "Administrator"

What does the powershell do?

What you did is simply create a script to uninstall outlook. So if Windows install the Outlook in the background, your script will counter which to uninstall Outlook without bothering you.

Wallah! Problem solved!

 

enlarge
docker
Posted: 14 May 2024, 19:18pm - Tuesday

 I have been using docker lately. I have these legacy personal projects that I can't just abandon them. Still display in my portfolio. :) Then my new projects are now using Symfony 6.4 with MySQL 8.0. It is the time that I need both MySQL v5.7 and v8.x to run side-by-side in my server. Here's my docker-compose.yaml

version: '3.1'

services:
   mysql8:
      container_name: docker_mysql8
      image: mysql:8.0
      ports:
        - 3313:3306
      restart: always
      environment:
        MYSQL_USER: user
        MYSQL_PASSWORD: xxx
        MYSQL_ROOT_PASSWORD: xxx
        MYSQL_ROOT_HOST: "%"
        MYSQL_PORT: 3306
      volumes:
        - /var/lib/mysqld8:/var/lib/mysql
      healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
        timeout: 20s
        retries: 10
      networks:
        - default
   mysql5_7:
      container_name: docker_mysql5_7
      image: mysql:5.7
      ports:
        - 3312:3306
      restart: always
      environment:
        MYSQL_USER: user
        MYSQL_PASSWORD: xxxx
        MYSQL_ROOT_PASSWORD: xxxx
        MYSQL_ROOT_HOST: "%"
        MYSQL_PORT: 3306
      volumes:
        - /var/lib/mysqld57:/var/lib/mysql
      healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
        timeout: 20s
        retries: 10
      networks:
        - default

 

then save it let's say at "/srv/mysql/docker-compose.yaml" and to initialise, run "docker-compose up -d"

one thing to remember though, if you want to make some changes. Never cast the command: "docker-composer down" because this will delete the data you got in the container unless you created backups.

instead, just do "docker-compose stop" to stop the container and "docker-compose start" when you want to get the container running again.

if errors encounter, simply just restart docker then cast "systemctl restart docker" then go to "/srv/mysql" and run "docker-compose up -d"

enlarge
Windows: Setting up Apache 2.4.48 and PHP 7.4.20
Posted: 13 Jul 2021, 23:43pm - Tuesday

Before going thru the steps below, you need to download the installers first at http://camilord.com/downloads/Apache2.4.48_PHP7.4.20.zip

Then, just extract the zip which will give you both apache (httpd-2.4.48-o111k-x64-vc15) and php (php-7.4.20-Win32-vc15-x64). They are also in a zip, extract it in "C:\" and rename it like below.

would look like:

C:\Apache24
C:\php

then in apache, go to httpd.conf and edit it.
Add the following lines:

# php 7.4.20 handler
AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
LoadModule php7_module "c:/php/php7apache2_4.dll"
PHPIniDir "c:/php"

you can skip this step, you only do this when you have existing apache installation

httpd -k uninstall -n "Apache2.4"

then save it. go to Apache24\bin using CLI or powershell (as administrator) then run:

httpd.exe -k install -n "Apache2.4"

this will install as a service. then to start and stop

httpd -k start
httpd -k stop

or

net start "Apache2.4"
net stop "Apache2.4"

then for PHP, copy the php.ini-development as php.ini then adjust the necessary configuration
needed by your application. then since you're in dev mode, add this at the end of the php.ini:

[Xdebug]
zend_extension="C:/php/ext/php_xdebug-3.0.4-7.4-vc15-x86_64.dll"
xdebug.client_port="9003"
xdebug.mode=debug
;xdebug.mode=profile

you can find the file in this folder and make sure you copy that xdebug dll file to C:\php\ext\

then restart the apache…

and if you have changes in your php.ini on next edit, restart again your apache.

enlarge
Zeacurity: Allow all to ssh except specific IP addresses
Posted: 8 Feb 2021, 3:12am - Monday

Since I open my ssh to all for the past 3 months, the auth.log is incredibly flooded with login attempts. I know they can't get in because I am using public key authentication and AllowedUser. Somehow it is still worrying the number of attempts.

So I created an app to counter these login attempts. Introducing my console app, Zecurity (https://github.com/camilord/Zeacurity). It's using Symfony Console framework and easy to use if you are having the same situation I got and want to protect your server. I wrote (I believe) the details how to implement on your server, please see the read me file.

Screenshot below, as you can see there's like every milliseconds attempting to login. Then I ran Zeacurity at 3:00 and after that, no attempts. :)

PS: when I was trying to resolve my problem, I stumble down with an issue that all incoming attempts still going thru, thanks to Sid Bachtiar when he mentioned about to remove the MASQUERADE and it was the one causing it. To read more about it, see https://linuxhacks.org/what-is-ip-masquerade-and-how-to-rule-it-with-iptables/

enlarge
Gradle Project Tests
Posted: 6 Jun 2020, 9:59am - Saturday

The Error:

gradle Caused by: org.junit.platform.commons.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath

I've been writing tests on my java gradle project and I thought the tests was running every time I compile. I'm using IntelliJ IDEA and when I right click the test folder and `Run All Tests`, seems to work well.

Then I found out that it wasn't running at all when I ran the report.

gradle didn't find my tests

"Five hours later..." I almost gave up and decided to go back to maven. Then thought maybe I will search the error one last time. Landed to this page: https://discuss.gradle.org/t/gradle-4-6-and-junit-5/26061 -- then decided to give one last try. So I change my build.gradle

plugins {
    id 'java'
    id 'project-report'
}

group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 11
targetCompatibility = 11

repositories {
    mavenCentral()
}

dependencies {
    compile 'postgresql:postgresql:9.0-801.jdbc4'
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
    //testCompile 'junit:junit:4.13'
}

to this new configuration:

plugins {
    id 'java'
    id 'project-report'
}

group 'nz.camilord.alphaone.sample'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 11
targetCompatibility = 11

repositories {
    mavenCentral()
}

dependencies {
    compile 'postgresql:postgresql:9.0-801.jdbc4'
    compile 'com.google.code.gson:gson:2.8.0'
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.2'
    testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.0.89'
    testRuntime 'org.junit.jupiter:junit-jupiter-engine'
    //testCompile 'junit:junit:4.13'
}

test {
    useJUnitPlatform()
}

configurations {
    externalLibraries
    compile.extendsFrom (externalLibraries)
}

... and the result is a success! It works!

enlarge
ASP.Net Core C#: Visual Studio 2019 missing UseSqlServer()
Posted: 21 Mar 2020, 0:17am - Saturday

Few days ago, been learning again ASP.Net C#, but this time its ASP.Net Core C#. It took me a while to resolve this issue because all the reference in the internet and stackoverflow were for Visual Studio 2017.

DotNet Version: 3.1 | IDE: VS 2019

In VS2017 might work just by adding:

use using Microsoft.EntityFrameworkCore;

But in VS2019, what works is both adding describe above and execute add package:

dotnet add package Microsoft.EntityFrameworkCore.SqlServer

after that, you problem should go away...

enlarge
My Meme Generator (mymeme.app)
Posted: 16 Jul 2018, 12:08pm - Monday
Hello, if you ever need to generate your own meme, just go to www.mymeme.app Very simple meme generator and easy to use. cheers!
enlarge
NZ Companies Register API
Posted: 25 Feb 2018, 3:50am - Sunday
In case you need it... https://github.com/camilord/nz-companies-register Very simple to use...
 
 
use camilord\NZCompaniesRegister\NZCompaniesRegister;
 
$obj = new NZCompaniesRegister();
$result = $obj->search('blue horn');
 
print_r($result);
 
Cheers!
enlarge
How do you kick a benign user off your system?
Posted: 7 Dec 2016, 22:17pm - Wednesday
There's probably an easier way, but I do this: See who's logged into your machine -- use who -u:
root@alphaone:~# who -u
root     pts/1        2016-12-08 11:02   .          7953 (192.168.0.99)
camilord pts/2        2016-12-08 10:59   .          7625 (192.168.0.7)
Laugh at their impending disconnection (this step is optional, but encouraged)
root@alphaone:~# echo "HAHHAHAHAHAHA... BYE!" | write root pts/1
write: write: you have write permission turned off.
Kill the corresponding process:
root@alphaone:~# kill -9 7953
  Reference: http://unix.stackexchange.com/questions/615/how-do-you-kick-a-benign-user-off-your-system
enlarge
Fastest way to connect to DB with existing .env
Posted: 10 Jul 2024, 14:34pm - Wednesday

 Several projects now I ended up to create a standalone script to do specific task. Loading doctrine would be using lots of resources. I always want to create a lite-weight script to do specific tasks but connecting to the DB is a bit tricky when you are in a framework (symfony + doctrine).

 
$connection = $_ENV['DATABASE_URL'];
list(
    $driver,,, $username, $password,
    $host, $port, $db_name, $extra1
) = preg_split('/(:|\/|@|\?|&)/', $connection);

$sql = new xSQL([
    'driver' => $driver,
    'port' => $port,
    'database' => $db_name,
    'host' => $host,
    'username' => $username,
    'password' => $password
], true);

 

This is how I do it.. Helps a lot doing this way.

enlarge
Netflix bug: Updating payment method
Posted: 28 Jul 2022, 20:27pm - Thursday

I registered my Netflix in New Zealand. So, credit card and mobile number will be NZ. Now, I moved to Australia. I need to update the information. So, I updated my mobile number to Australia. But then, when I update my credit card, it's asking for confirmation code but the form is in NZ! Then keep saying "Something went wrong!" Of course because your form is wrong. Because your form is using NZ form for the mobile confirmation. So dumb!

Don't get me wrong! Both countries have confusing flags. But I do know the difference between the flags. :) Back to the topic. Now, how can update my credit card?

So I contacted Live Chat and their recommendation, deactivate my account! Nice!

Now I have to wait until 27 August 2022 so I can update my credit card. Great! Best system!

enlarge
testssl.sh - testing SSL
Posted: 12 Jul 2021, 20:33pm - Monday

I have been using https://www.ssllabs.com/ssltest/analyze.html and today I found a script to give me report the same ssllabs.com does.

The bash script based is really good. Very helpful giving me the report I need.

https://testssl.sh/ -- You can download the script from their github.

Here's the sample report: (I can display this because its an A+ verdict)

enlarge
My Progression to Senior Software Engineer at Objective
Posted: 13 Oct 2020, 1:51am - Tuesday

In 2012, I was visiting my sister in New Zealand when I decided I wanted to move over there from The Philippines, too. Soon I was working as a PHP/SQL Programmer, developing and maintaining New Zealand’s first end-to-end Building Consenting System, AlphaOne.

I enjoyed it and it was very demanding. I was pretty much solely responsible for managing AlphaOne and had to wear multiple hats in addition to writing code. When AlphaOne was acquired by Objective last year, I felt a really welcome change to my job.

There’s so much support: everything is manageable. My worklife balance has changed dramatically and I now enjoy my weekends without worrying about work, here’s a little bit more about how I got here and what it’s like working at Objective.

My road to Senior Software Engineer at Objective

I graduated with a BS Information Management in 2008 from Xavier University, Philippines. While studying, I freelanced as a desktop application developer (using .Net C# + MySQL) and I mostly wrote web based applications, using PHP or LAMP stack.

After working for a while as a lecturer, I was employed remotely by companies all over the world to do PHP web applications, maintain or build applications and websites, and manage web servers.

Eventually I found myself in NZ on the AlphaOne project. ] With one remote and two on-site developers, we managed to stabilise the system and grow our client base from 2 to 12 in just 3 years.

AlphaOne was acquired by Objective in March 2019 and as the Senior Software Engineer for Alpha One, I love working for Objective! I write code, manage our mail and web servers and am also responsible for developing hybrid mobile applications (a mobile version of AlphaOne), so we can easily maintain and deploy it on the Apple, Google and Windows stores.

How I developed my skills

In 2004, before I knew anything at all about the existence of Facebook, I had a very similar idea. I didn't write the code until 2005 though, when I built my own popular and exclusive social network called Zabyer.

The challenges I faced with it (such as performance degradation, compatibility issues, exploitation and hacking) brought my knowledge up to a commercial level long before I’d even finished university. Then, equipped with that knowledge, I started freelancing, which added to my skills in dealing with customers and clients.

I created another social network in 2008 but I struggled to finance it and realised I really just needed money. That’s when I began working remotely for multiple companies, before finding my job at AlphaOne.

The most important things I’ve learned on my career journey

Probably the most important things I’ve learned over the years are:

  • Working with a legacy system and someone else’s code is hard! But you should learn to appreciate other people’s work because you have the knowledge to improve it.
  • Every developer has their own style, so whoever you’re on a team with, come up with rules you can all agree on. I’ve also learned I should get my teammates involved with what I’m doing instead of making them wait around for my part.
  • When it comes to small-medium businesses, I’ve learned how to balance what a business wants and is capable of, with its customers’ needs. With the information from both sides, I can recommend and easily deliver the output.

How we develop our engineers at Objective

At Objective, our best and well-tested approach is to start off new employees on bug fixing (from easy to hard) and guide them closely. This way, they will learn the project structure, flows and its ecosystem.

I don't tell them all the details, but I do show them how it is done rather than giving a long list of instructions. A visual presentation stays in the mind a lot better. Once they catch up with the other developers, they can be eased into bug fixing and other mixed tasks, like new stuff and best practices.

We like to include our new engineers in research and development as well, to make them excited about new technologies and boost their confidence to do more things. I always listen to their ideas and allow them to explore: I want them to feel like they are truly contributing to a project.

Personally, I’m glad all my hard work has led me here. I love the culture and the energy of this company. To me, Objective is the perfect workplace!

Do you think you have what it takes to become part of our engineering team at Objective? Check our careers page for job openings!

enlarge
IntelliJ IDEA + Java versions + Maven + Gradle
Posted: 5 Jun 2020, 11:57am - Friday

Ok, I have been writing java codes from quite some time now. And most common I forgot to set are the following areas to configure in IntelliJ IDEA.

  1. Project Structure - always set both Project SDK and Project Language Level

2. SDK - you have to define the JDK home path to use in your project

3. Java bytecode - ensure that you set the Project bytecode version and add your project in per-module bytecode version and define the target bytecode version.

4. Maven - pom.xml file

5. Gradle - build.gradle file

And if you fail to configure these versions, you'll end up seeing RED texts/icons.

Gradle JVM not set properly, was set to 13 instead of 11.
Gradle JVM setup correctly.

enlarge
zsh -> grml
Posted: 18 Nov 2019, 1:09am - Monday
It's been a while I haven't posted something in my blog. Since AlphaOne was acquired by Objective Corporation and our PC will be replaced with Laptops (I felt its a downgrade really but there's nothing I can do about it.) So start setting up my Ubuntu environment under VM which I'm gonna clone the image and just place it into that laptop. I've seen my workmate using the custom shell and I find it handy in development. Here's how to set it up: install zsh package
$ sudo apt install -y zsh
download grml's zsh configuration
$ cd ~/; wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
then run zsh
$ zsh
that's it.. will look like this:         also you can make zsh-grml shell as default:
chsh -s /bin/zsh
or
camilord@camilo3rd-ubuntu /srv/localhost/alpha1v1 (git)-[3508-fixing-unit-test] % chsh
Password: 
Changing the login shell for camilord
Enter the new value, or press ENTER for the default
	Login Shell [/bin/bash]:    
enlarge
[ssllabs.com] How to get "A+" on SSL Server test
Posted: 23 Mar 2018, 9:38am - Friday
Nowadays its very important that you configure your Server's SSL right. So one thing to test your configuration is enter your website at Qualys SSL Server Test and get your score. So far, I can score A+ for this unlike the security headers, I only get "A". Its very simple to achieve this, just edit /etc/apache2/conf-available/ssl.conf and change following:
SSLProtocol all -SSLv2 -SSLv3

SSLHonorCipherOrder on
Then save your changes and restart your Apache. That's it! You should get an A+ for that. Note: It was just recently that you have to turn on that SSLHonorCipherOrder or "Apache for Forward Secrecy" to ON. Reference: https://www.digicert.com/ssl-support/ssl-enabling-perfect-forward-secrecy.htm
enlarge
PHP: about NULL vs 0
Posted: 18 Sep 2017, 20:43pm - Monday
A client reported about the data wasn't populating... So I debug and took me hours to find out... Background: We have this enterprise system with legacy code and we created a QueryDriver class to make the legacy, Silex DBAL & CodeIgniter works and reusable. Behind the QueryDriver, it uses vsprintf() function.
$parcelData = [];
$jobVarObj = new JobsVarsTable();
$jobVarObj->setDrivers($this->getQueryDriver());
$prime_parcel = $jobVarObj->getVarValue($this->job_id, 'PRIMARY_PARCEL');

...

$q = "SELECT * FROM jobs_parcels WHERE JID = '%d' AND ID != '%d' AND Deleted IS NULL";
$sql = $this->getQueryDriver()->fetchAll($q, [$this->job_id, $prime_parcel]);
$parcel_data_list = $sql->getData();

In that codes above, the $parcel_data_list is always empty and I know there are 1 row results. 2 hours later... Note: $prime_parcel = null; // if does not exists in the records, will return literal null I just realised that printing vsprintf($q, [ $this->job, $prime_parcel ]) will gave me what I expected because when you sprintf() or vsprintf() the NULL to %d, this will convert to ZERO. But actually when I pass the query to our QueryDriver, %d and %s are actually converted to ? which the NULL become literal NULL in the query. Instead of "SELECT * FROM jobs_parcels JID = '123' AND ID != '0' AND DELETED IS NULL" then becomes "SELECT * FROM jobs_parcels JID = '123' AND ID != NULL AND DELETED IS NULL". So there will be no result. So lesson learn... Solution:
$parcelData = [];
$jobVarObj = new JobsVarsTable();
$jobVarObj->setDrivers($this->getQueryDriver());
$prime_parcel = (int)$jobVarObj->getVarValue($this->job_id, 'PRIMARY_PARCEL', 'n');

...

$q = "SELECT * FROM jobs_parcels WHERE JID = '%d' AND ID != '%d' AND Deleted IS NULL";
$sql = $this->getQueryDriver()->fetchAll($q, [$this->job_id, $prime_parcel]);
$parcel_data_list = $sql->getData();
Then it solves my 2hrs problem!!! Ok that's my entry for half of 2017... hehehe.. Cheers!
enlarge
BeeCheckout Online Ordering System
Posted: 19 Jun 2024, 16:59pm - Wednesday

 When you own a restaurant or food shop, online presence is highly recommended to increase sales. Ordering online is a must too. Several online ordering providers are in the wild and daunting to choose from. Then, most of them are commission based platform!

Imagine a online ordering system that bill you on fixed price, not commission based, which more profitable on your side? Try BeeCheckout - https://www.beecheckout.com, take control of your sales and say good bye with commission based platform.

enlarge
VM: Resize Partition on a running system
Posted: 20 Sep 2021, 22:09pm - Monday

I was stuck for a while how to resize a running partition in my VM. Been searching for answers and all answers are quite long except this one:

root@silex5:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           798M  1.1M  797M   1% /run
/dev/sda2        49G   32G   15G  69% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0      100M  100M     0 100% /snap/core/11420
/dev/loop1       18M   18M     0 100% /snap/pdftk/9
/dev/loop2      100M  100M     0 100% /snap/core/11606
tmpfs           798M     0  798M   0% /run/user/1011

root@silex5:~# growpart /dev/sda 2
CHANGED: partition=2 start=4096 old: size=104851456 end=104855552 new: size=251654111,end=251658207

root@silex5:~# resize2fs /dev/sda2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 15
The filesystem on /dev/sda2 is now 31456763 (4k) blocks long.

root@silex5:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           798M  1.1M  797M   1% /run
/dev/sda2       118G   32G   81G  29% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop0      100M  100M     0 100% /snap/core/11420
/dev/loop1       18M   18M     0 100% /snap/pdftk/9
/dev/loop2      100M  100M     0 100% /snap/core/11606
tmpfs           798M     0  798M   0% /run/user/1011
root@silex5:~# reboot

Reference: https://unix.stackexchange.com/questions/137482/how-to-to-resize-an-ext4-partition-from-the-command-line

enlarge
Free Planning Poker
Posted: 12 Jun 2021, 13:26pm - Saturday

Hello Agile/Scrum people ...

If you are looking for free planning poker, use http://www.freeplanningpoker.co.nz/ or http://www.freeplanningpoker.site/ or http://www.freeplanning.poker/ and there will be no ads or limitation of 5 users or 5 issues then try to force you to upgrade to premium. The limitation is like it can create 100 issues of each gameplay and of course limit to 8 players, more than that will be a conference already. So 8 users or players, cast a vote and get the score for your issues.

This application is used for team management amd planning for agile team.

enlarge
Cleaning HDDs and monitor it
Posted: 24 Jun 2020, 1:21am - Wednesday

I've been assigned to clean up our server hardware and trying to create a monitoring how the progress going.

---------------- s04_wipe.sh ----------------------
#!/bin/bash

# s04
dd if=/dev/zero of=/dev/sdg status=progress
dd if=/dev/urandom of=/dev/sdg status=progress

---------------- s03_wipe.sh ----------------------
#!/bin/bash

# s03
dd if=/dev/zero of=/dev/sdf status=progress
dd if=/dev/urandom of=/dev/sdf status=progress

---------------- s02_wipe.sh ----------------------
#!/bin/bash

# s02
dd if=/dev/zero of=/dev/sde status=progress
dd if=/dev/urandom of=/dev/sde status=progress

---------------- s01_wipe.sh ----------------------
#!/bin/bash

# s01
dd if=/dev/zero of=/dev/sdd status=progress
dd if=/dev/urandom of=/dev/sdd status=progress

---------------- uat_wipe.sh ----------------------
#!/bin/bash

# uat
dd if=/dev/zero of=/dev/sdc status=progress
dd if=/dev/urandom of=/dev/sdc status=progress

---------------- db_wipe.sh ----------------------
#!/bin/bash

# database
dd if=/dev/zero of=/dev/sdb status=progress
dd if=/dev/urandom of=/dev/sdb status=progress

----------------os_wipe.sh ----------------------
#!/bin/bash

# os disk
dd if=/dev/zero of=/dev/sda status=progress
dd if=/dev/urandom of=/dev/sda status=progress

I ran it this way...

nohup bash s02_wipe.sh > sde.out 2>&1 &

then this is my monitoring script (monitor.sh) to check the status:

#!/bin/bash

echo "/dev/sdb: "
echo $(tail -n 1 -c 120 sdb.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"
echo "/dev/sdc: "
echo $(tail -n 1 -c 120 sdc.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"
echo "/dev/sdd: "
echo $(tail -n 1 -c 120 sdd.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"
echo "/dev/sde: "
echo $(tail -n 1 -c 120 sde.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"
echo "/dev/sdf: "
echo $(tail -n 1 -c 120 sdf.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"
echo "/dev/sdg: "
echo $(tail -n 1 -c 120 sdg.out) | rev | cut -d "s" -f1,2,3,4| rev
echo -e "\n"

then run it by:

watch -d "bash monitor.sh"

if you're needing like this, feel free to use my method.

enlarge

I recently encountered a weird error on my repo when I "git push" or "git pull" in Windows 7. But when I tried it on my Mac, Ubuntu & Windows 10, its working fine.

Windows 7 - PHPStorm Terminal - git pull

As shown above, that's the error I am getting when I pull/push. I tried the solution from others:

reference: https://stackoverflow.com/questions/4485059/git-bash-is-extremely-slow-on-windows-7-x64

But unfortunately it didn't resolve my problem. Somehow, it did made it a bit faster.

I already tried many things, but I cannot find any solution that works for my problem. I know that the issue is just in my PC, even tried emptying my hosts file still didn't work.

Then a lightbulb popup, maybe I should delete my current repo and checkout again. So I did and resolve my problem. I can pull and push after that.

enlarge
CentOS / RHEL 7 : How to create custom daemon service
Posted: 25 Jul 2018, 13:08pm - Wednesday
First, create the script you want to run...
# vi /root/firewalld.sh
#!/bin/bash
iptables -F
iptables -L
Then make this executable...
chmox u+x /root/firewalld.sh
then you need to create the daemon service
# vi /etc/systemd/system/sample.service
[Unit]
Description=Description for sample script goes here
After=network.target

[Service]
Type=simple
ExecStart=/root/firewalld.sh
TimeoutStartSec=0

[Install]
WantedBy=default.target
definitions:
After= : If the script needs any other system facilities (networking, etc), modify the [Unit] section to include appropriate After=, Wants=, or Requires= directives.
Type= : Switch Type=simple for Type=idle in the [Service] section to delay execution of the script until all other jobs are dispatched
WantedBy= : target to run the sample script in
then cast the commands below:
# systemctl daemon-reload
# systemctl enable sample.service
# systemctl start sample.service
# systemctl reboot
after rebooting, your script should be executed.   Reference: https://www.thegeekdiary.com/centos-rhel-7-how-to-make-custom-script-to-run-automatically-during-boot/
enlarge
[securityheaders.io] Getting an "A"
Posted: 22 Mar 2018, 11:29am - Thursday
We've been dealing with our servers and systems security audit. One thing I need to achieve is getting an A score in our security headers. So far I got "A" and if you are achieving the same goal, here's the steps: Go to /etc/apache2/conf-available and edit security.conf then at the bottom of the file, add the following below:
#
# to apply this settings, you must enable apache headers first...
# e.g.: a2enmod headers
#
# headers customised by camilo3rd | 2018-03-22 ---- [start]
#
Header unset Content-Security-Policy
#Header add Content-Security-Policy "default-src 'self'"
Header add Content-Security-Policy "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; report-uri https://www.abcs.co.nz/violationReportForCSP.php;"

Header unset X-Content-Security-Policy
#Header add X-Content-Security-Policy "default-src 'self'"
Header add X-Content-Security-Policy "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';"

Header unset X-WebKit-CSP
#Header add X-WebKit-CSP "default-src 'self'"
Header add  X-WebKit-CSP "default-src * 'self'; img-src * 'self' data: 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; script-src * 'self' 'unsafe-inline' 'unsafe-eval';"
Header always set Referrer-Policy "same-origin"

Header set X-Content-Type-Options "nosniff"
Header set X-XSS-Protection "1; mode=block"
#Header set X-Frame-Options "DENY"
Header set X-Frame-Options SAMEORIGIN
Header set Strict-Transport-Security "max-age=631138519; includeSubDomains"
#
# headers customised by camilo3rd | 2018-03-22 ---- [end]
#
Then save.. Restart your apache and that's it. You should get an A score. To understand those statements above especially the values, please refer to:
  • https://developers.google.com/web/fundamentals/security/csp/
  • https://content-security-policy.com/
enlarge
Backup your files on any Android smartphones
Posted: 15 Apr 2017, 12:05pm - Saturday
Alright, I stumble with Huawei LYO-L02 model which very primitive model and can't even get a support on it. If you plug to your PC, nothing happens. You cannot access the internal storage. So the question is how do I backup the contents of my phone? Here's the simple steps:
  1. Install an App in your phone called "SSHD"
    • after installing, create a server and set the port then add a user
    • start the server or SSHD
    • once started, it will show the IP address where your SSHD can be connected
  2. Then in your Desktop computer or laptop (PC/Mac) , install FileZilla
  3. Remember, your phone and computer should be connected to the same WiFi or network.
  4. Open your FileZilla, go to site manager and add new site
  5. Enter the IP address provided in step 1 then port, username and password.
  6. On protocol, select SFTP (SSH File Transfer Protocol) then connect
  7. After connecting, it will give an error like cannot read directory because its reading to "/" root directory. In Android, the default storage of the files will be "/storage/" so just change the address bar on Filezilla and press enter and this will show you few directories.
  8. Just find the folder you want to backup and drag to your computer.
  9. Wallah! You just backup your smartphone files.
enlarge