Mac Quick Tips

Below is a list of commands that I found useful whilst working in a Mac environment.  I have not attempted to explain what each command does in details, as there are tons of online materials that  do that already. Do ensure you have the right privileges whilst executing the commands. So here we go:

FIND DIRECTORY OF YOUE MOST RECENT JAVA VERSION

/usr/libexec/java_home -v

Output:

/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home

CHECKING THAT A PROCESS IS RUNNING ON A PORT e.g. 9000

> ps -ef | grep 9000
>netstat -anp | grep 9000

For all processes:  > netstat -anp

FETCHING AN IP ADDRESS

> sudo /sbin/ifconfig

COMPRESSING AND  UN-COMPRESSING FILES

> tar -cvzf srcbackup.tgz {directory}

-c: compress  -v: verbose -z : use Gzip -f: zipped file name

> tar -xvzf srcbackup.tgz  {directory}

-x: extract

SECURE COPY

Copy the file “foobar.txt” from a remote host to the local host

$ scp your_username@remotehost:foobar.txt /some/local/directory

Copy the file “foobar.txt” from the local host to a remote host

$ scp foobar.txt your_username@remotehost:/some/remote/directory

Copy the directory “sample” from the local host to a remote host’s directory “test”

$ scp -r sample your_username@remotehost:/some/remote/directory/test

 

CHECK ALL ACTIVE CONNECTIONS ON A MACHINE

> #sudo netstat -tuplen

CHECK ALL PROGRAMS THAT PROVIDE JAVA

# sudo alternatives –config java

Output:
There are 2 programs which provide ‘java’.
Selection    Command
———————————————–
*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java

Enter to keep the current selection[+], or type selection number:

CHECK THE TLS CERTIFICATE ON A SERVER (e.g. an smtp server)

# sudo openssl s_client -connect mail.sever.com:25 -starttls smtp < /dev/null

</dev/null – is not required ans its just to end the command.

HOW TO MANAGE CENTOS SYSTEM SERVICES

A  very good write-up . Thanks Milosz .

DELETING ALL FILES EXCEPT FOLDERS WITHIN A DIRECTORY
# sudo find . -maxdepth 1 -type f -delete

FIND OUT LAST REBOOT DATE, TIME AND WHO
https://www.cyberciti.biz/tips/linux-last-reboot-time-and-date-find-out.html

FIND OUT ALL SOCKETS ON THE SYSTEM

sudo find / -type s

Some Previous Projects

Note : The projects listed below are those available online and are outside firewalls:

  • AnnotationTypeCvImporter  – Annotation Types Importer import annotation type and controlled vocabularies from a simple flat file into BASE
  • AffyArrayDesignBatchImporter – Batch imports affymetrix files and creates Array Design in BASE.
  • Tab2MageImporter – Imports into BASE 2, raw data files and experimental metadata from a zipped archive containing a tab2mage formatted description of the experiment and a set of raw data files.
  • Tab2MageExporter : From a BASE2 Experiment Item, the plugin exports the experimental metadata as a tab2mage specification compliant file.

Free but Cool Software and Design Tools

The following tools are free, some open source!, and are essential tools in a software engineers and developers tools box.

  1. Komodo Edit – free programmable editor that supports many languages and programming frameworks.
  2. Visual Studio Code –  highly visual code editor available for Windows, MacOS, and Linux. It also supports a wide variety of programming languages (e.g. JavaScript, C#, Swift etc).
  3. Appear.in – Video conversions with up to 8 people.
  4. Ryver –  A lightweight alternative to Slack  for team communication.
  5. Atom – a hackable editor that can be extended through packages for specific languages or functions. Also has  “themes” that modfies the appearance of the editor.
  6. Vox Vote – Free and easy to use mobile and web-based voting tool for live audience polling and voting. An alternative to SurveyMonkey.
  7. Canva – Online graphics creation tool for beginners, with free templates.
  8. Piktpchart – online tools for creating infographics, flyers, posters, presentations etc. Free version available.
  9. Wideo –  tool for creating animated videos and presentations.
  10. Powtool  –  tool for creating animated videos and presentations.

Hope you find it useful.

Singing out!.

Inventing on Principle & Light Table

Below is one interesting talk in Inventing on Principle by
Bret Victor. (Creators Need an Immediate Connection!!!)

Larry Tesler – http://nomodes.com/Larry_Tesler_Consulting/Home.html

Light Table is a completely new form of IDE, which gives you immediate feedback. An IDE built on the Principle that Creators Need an Immediate Connection.

Equation

How stuff works

In this post I shall be pointing to key online resources that provides good explanation on a range of simple to complex technological concepts :

 

I shall update the pages as I come across any nice and exciting concepts and technologies.

Hope you find it useful.

Signing off  but feel free to ‘Talk’ back!

How to Digitally Sign a jar file

Requirement: Purchase a certificate from one of the commercial digital signature agencies before going public with the jar file.
However for local and personal work and testing use a self sign certificate.

Begin

1. Create a new key in a new store

C:\ keytool -genkey -keystore myKeyStore -alias myself
–input all required information
–Note the keystore file (myKeyStore) will be stored on disk e.g c in windows

2. Create a self -signed test certificate
c:\ keytool -selfcert -alias myself -ketstore myKeyStore
–create password as required

3. Verify that your personal self certificate has been created.
c:\ keytool -list -keystore myKeyStore
— This should list the certificate fingerprint

4. Now sign the jar file with the test certificate
jarsigner -keystore myKeyStore nutribase.jar myself

End

The signed jar file will be recognised and acceptable by all applet enabled browsers, java web start and any other mechanism that requires a signed jar file.

 

Additional Reading / Resources

  • Other usage of Java keytool  is provided here

Simple Network Management Protocol (SNMP) TRAPS

SNMP Traps are generated when a condition is met on SNMP agent(s) residing on a network device. These conditions are set in a database (Management Information Base) consisting of  the PDUs (Protocol Data Units) and OIDs (Object Identifiers)   A network administration is able to set the threshold for the occurrences of an event before a trap is generated. Whenever a trap is to be generated the agent creates an SNMP packet sent to the SNMP trap host (Manager responsible for monitoring SNMP traps), or manager, through UDP port 162. The SNMP packet specifies the following:

  • SNMP Version: v1 or v2
  • Community: Community name of the SNMP agent (defined on the agent)
  • PDU TYPE: SNMPvX Trap (4)
  • Enterprise: Corporation or organization that originated the trap, such as .1.3.6.1.4.1.x
  • Agent Address: IP address of the SNMP agent
  • Generic Trap Type: Cold Start, Link Up, Enterprise, etc.
  • Specific Trap Type: When Generic is set to Enterprise a specific trap ID s identified
  • Timestamp: The value of object sysUpTime when the event occurred
  • Object x Value x: OID of the trap and the current value.

 

 

Comparing JVM Web Frameworks

Have you been faced with the which web framework do I use question?  You are not alone…… Matt Raible @ Devoxx 2010 did a good job providing a well written comparison of web framework based on criteria to rank them, with a suggestion on how to approach selecting one for  your projects:

Comparing_JVM_Web_Frameworks  | Spreadsheet

Note: might be slightly old but still provide insightful information.

SMS Gateways

SMS GATEWAYS AND API

1. SMS Library for the Java Platform

2. Ozeki NS SMS Gateway

3. Twilio

4. Clickatell