Tech notes and other stuff https://j3ffrw.github.io/posts/ Recent content on Tech notes and other stuff Hugo -- gohugo.io en-us Sun, 19 Nov 2023 00:00:00 +0000 Initial setup of Mikrotik Chateau 5G https://j3ffrw.github.io/p514/ Sun, 19 Nov 2023 00:00:00 +0000 https://j3ffrw.github.io/p514/ Initial setup of Mikrotik Chateau 5G in preparation for Terraform management Notes on intial router settings: default IP address is 192.168.88.1 both wireless and LAN ports 1 to 5 are assigned to same bridge. LTE modem is assigned as WAN port. Things to configure Admin credential Hostname Default wifi password Web console https Updating RouterOS and LTE modem firmware without a SIM card attached Admin credential After a config reset accessing the router webconsole or ssh you will be asked to give a password for admin Upload your ssh public key and assigned it to admin. Initial setup of Mikrotik Chateau 5G in preparation for Terraform management Notes on intial router settings:

  • default IP address is 192.168.88.1
  • both wireless and LAN ports 1 to 5 are assigned to same bridge.
  • LTE modem is assigned as WAN port.

Things to configure

  1. Admin credential
  2. Hostname
  3. Default wifi password
  4. Web console https
  5. Updating RouterOS and LTE modem firmware without a SIM card attached

Admin credential

  1. After a config reset accessing the router webconsole or ssh you will be asked to give a password for admin
  2. Upload your ssh public key and assigned it to admin.
# on your local machine's terminal
scp ~/.ssh/key.pub [email protected]:./
# on Mikrotik terminal
/user/ssh-keys/ import public-key-file=key.pub key-owner=admin user=admin

Set router hostname

/system/identity/set name=yourRouterHostname

Configure default SSID passwords (2.4G/5G)

  1. By default both 2.4G and 5G SSID uses the same “default” security profile.

Note: from @rextended https://forum.mikrotik.com/viewtopic.php?t=183221

All special characters must be put inside quotes, or, for one reason or another, cause errors.
Some chracters must be escaped
" if used as character, and not for contain a string, must be escaped like \"
$ if used as character, and not for start a variable or function name, must be escaped like \$
? on RouterOS 6.x Terminal must be escaped with \ like \? (stored script inside scirpt, scheduler, dhcp, ppp profiles, etc. , do not need to escape the ? )
\ the \ is the escape symbol, for use \ as character instead, escape it like \\
/interface/wireless/security-profiles/set default wpa2-pre-shared-key="yourWifiSecuredPassword" authentication-types="wpa2-psk" mode="dynamic-keys"

Configure webconsole HTTPS

  1. Upload server ca bundle and server key
# on your local machine's terminal
scp server_ca-bundle.pem [email protected]:./  # cert must contain full chain/bundle server,intermediate-ca,root-ca
scp server.key [email protected]:./
  1. Import certificates and assign to www-ssl service
/certificate/ import name=yourCertificateName
/ip/service/ set www-ssl certificate=yourCertificateName disabled=no

Updating RourterOS7 and LTE modem firmware without a SIM card

This creates a new bridge where one of the LAN ports can be assigned to it and obtain IP from upstream modem/router

  1. Create bridge
/interface/bridge/add name=yourBridgeName comment="bridge for ethernet WAN"
  1. Assign LAN port No. 5 into newly created bridge.
/interface/bridge/port/ set 4 interface=ether5 bridge=yourBridgeName
  1. Add a dhcp client and assign it to newly created bridge
/ip/dhcp-client/add interface=yourBridgeName
  1. Once port 5 have acquired an IP from upstream modem/router. You can perform the upgrade as directed by the official guide
]]>
Replace Tuya WB3s base IR blaster with ESP-12F https://j3ffrw.github.io/p513/ Thu, 01 Dec 2022 00:31:19 +0800 https://j3ffrw.github.io/p513/ After acquiring another Tuya compatible IR blaster from the same brand/seller I found out that they no longer use an ESP chip. Instead they’ve opted to use Tuya’s WB3s chip. This is not compatible with ESPHome(at the time of this writing). Luckily this module is a chip for chip replacement of most ESP8266 module like ESP-12F wb3s chip Removal of WB3s module. I used bismuth to help me in the desoldering. After acquiring another Tuya compatible IR blaster from the same brand/seller I found out that they no longer use an ESP chip. Instead they’ve opted to use Tuya’s WB3s chip. This is not compatible with ESPHome(at the time of this writing).

Luckily this module is a chip for chip replacement of most ESP8266 module like ESP-12F

wb3s chip

wb3s chip

Removal of WB3s module. I used bismuth to help me in the desoldering. Bismuth lowers the melting temperature of existing solder when mixed.

wb3s removed

wb3s removed

Soldering of ESP12-F and associated pull-up resistor on GPIO_0 and GPIO_2 with pull-down resistor on GPIO_15 1

ESP-12F

ESP-12F

Intial attempt on programming ESP-12F failed as the chip doesn’t seem to respond when attempting to download the esphome firwmware.

ESP-12F

ESP-12F

After troubleshooting the tx and rx pin had to be isolated from the board as it prevents programming.

capton tape on tx/rx pads

capton tape on tx/rx pads

Re-soldering back ESP-12F, I didn’t resolder back the pull-up resistor as it doesn’t seem to affect the boot up anyway.

ESP-12F

ESP-12F

ESP-12F

ESP-12F

]]>
Flashing Generic Tuya IR Blasters with ESPHome https://j3ffrw.github.io/p512/ Thu, 01 Sep 2022 00:31:19 +0800 https://j3ffrw.github.io/p512/ Recently I had a need for a cheap IR Blaster for Home Assistant climate integration that doesn’t require a cloud to work. After a lengthy google search I found others were able to use a generic round Tuya IR blaster by reflashing them with ESPHome which suites my need. So I decided to get one for Php 390 in one of ecommerce site in my place. This one has a esp8266 chip. Recently I had a need for a cheap IR Blaster for Home Assistant climate integration that doesn’t require a cloud to work. After a lengthy google search I found others were able to use a generic round Tuya IR blaster by reflashing them with ESPHome which suites my need. So I decided to get one for Php 390 in one of ecommerce site in my place. This one has a esp8266 chip.

One advantage on going this route instead of creating your own one lets say base on a wemos d1 is that you already have a nice case w/ a superb IR filtering plus a bunch of LED array complete with supporting circuitry so you can focus on high level integration stuff.

esp8266 chip

esp8266 chip

Tools needed.

  1. USB to 3.3V Serial adapter
  2. 5 pcs test leads with needle tip
  3. 3rd hand(s) for holding the test leads

To reflash the ESP chip you need to find the ff pads/pins in the IR blaster.

  1. TX
  2. RX
  3. GND
  4. 3.3V
  5. GPIO0

Wiring usb-to-serial adapter.

Flashing with ESPHome Web.

  1. Plug your usb-to-serial adapter to your PC/laptop. It would show up as port /dev/ttyUSB#
  2. visit https://web.esphome.io/?dashboard_wizard using Google Chrome or Chromium browser
  3. Press Connect and select your usb-to-serial adapter port.
  4. Press “Prepare For Adoption”. This would take several minutes to finish.
  5. Once flashing is done, unplug the usb-to-serial adapter and disconnect GPIO0 from GND.

Configure ESPHome wifi

  1. Plug your usb-to-serial adapter back your PC/laptop to power up the IR blaster.
  2. Wait for 10 seconds for ESPhome to boot up. Esphome will create a wifi AP with a captive portal.
  3. From your PC/laptop scan your wifi for SSID ‘esphome-web-######’. Connect to that SSID.
  4. Visit http://192.168.4.1 to configure ESPHome to connect to your IOT specific wifi network for security, as they say it’s the S in IOT.
  5. At this point your ESPHome IR blaster is will be discoverable in ESPHome Dashboard or from Home Assistant.
]]>
LRTimelapse timer free Max https://j3ffrw.github.io/p511/ Sun, 15 Nov 2020 00:31:19 +0800 https://j3ffrw.github.io/p511/ Here’s my assembly guide for LRTimelapse timer free Max an intervalometer on steroids. Where to get one. Contact Hans/Sheeba at forum.lrtimelapse.com Hardware versions There are several versions of LRTimelapse Pro Timer 3 and 2.511 , from the developer of LRTimelapse software, Gunther Wegner, this a commercial fully working unit, just buy the cable for your camera and off you go. Skip the rest of the article :p The Open Source free timer LRTimelapse timer free , also from Gunther, based on Arduino Uno and common LCD/button shield, source code LRTimelapse Pro Timer free Max, based on MEGA 2560 mini and common LCD/button shield. Here’s my assembly guide for LRTimelapse timer free Max an intervalometer on steroids. Where to get one. Contact Hans/Sheeba at forum.lrtimelapse.com

Hardware versions

There are several versions of

  1. LRTimelapse Pro Timer 3 and 2.5 11 , from the developer of LRTimelapse software, Gunther Wegner, this a commercial fully working unit, just buy the cable for your camera and off you go. Skip the rest of the article :p
  2. The Open Source free timer LRTimelapse timer free , also from Gunther, based on Arduino Uno and common LCD/button shield, source code
  3. LRTimelapse Pro Timer free Max, based on MEGA 2560 mini and common LCD/button shield. 1 . Using the free timer as the base, Hans started adding lots of features, hence the upgraded Arduino.
  4. LRTimelapse Pro Timer free Max/Mega 2, using MEGA 2560 mini and TFT display configured in landscape layout.
  5. LRTimelapse Pro Timer free Mega 3, using MEGA 2560 mini and TFT display configured in portrait layout.

Parts

When purchasing the kit, you also have several options to take, buy a fully assembled working kit, or buy only what you need which is the one I took. So that I could buy two sets and source the other parts locally.

Here’s the content of the kit per set that I bought

  1. 1 pc x Carrier board v1.3
  2. 2 pcs x 3.5mm TRS socket
  3. 1 pc x Single Pole Double Throw (SPDT) Switch
  4. 1 pc x TP5100 Battery charger, already configured for 8.4V
  5. 1 lot x 1-row 2.54mm female headers for LCD display
  6. 1 lot x 2-row 2.54mm male headers for Mega
  7. 1 pc x fiber optic light guide
  8. Housing and 3D printed buttons

Also included in thru email are some instructions on soldering the components, compiled firmware(v1.25 at that time), and how to upload it to Arduino using Xloader(Windows).

These are the parts I sourced locally here in the Philippines.

  1. 1 unit x Arduino Mega 2560 Pro Mini
  2. 1 pc x 5V to 12V DC-DC converter
  3. 1 pc x LCD button shield
  4. 2 pcs x BC547 General Purpose NPN Transistor
  5. 1 pc x 2N4403 (BC557B)
  6. 2 pcs x 4.7k ohm resistor
  7. 2 pcs x 10k ohm resistor
  8. 2 pcs x 1k ohm resistor
  9. 1 pc x 200k ohm resistor
  10. 1 pc x 3.9k ohm resistor
  11. 1 pc x 2.2k ohm resistor
  12. 1 pc x 9V battery
  13. 1 pc x 1N5819 Schottky barrier rectifier diode (BAT48)
  14. 1 pc x 220uF 16V electrolytic capacitor
  15. 1 pc x 1uF 16V electrolytic capacitor
  16. 1 pc x DC Socket, PCB mounted
  17. 1 pc x EBL 9V 6F22 600mAh Lithium-ion Rechargeable

Assembly

Assembly is started by soldering the following components into the carrier board

  1. resistors and diode
  2. capacitors and transistors
  3. female headers
  4. SPDT switch, DC socket, and TRS socket
  5. TP5100, you’ll need to use excess wires from the resistor to solder this to the carrier board

Once this is done. It would be good at this point to inspect if there are possible shorts and cold solder. I also did some testing on the TP5100 to make sure it working as expected

Without the 9V battery apply 12V via the DC socket. Both the CHG and STDY LED should light up and flash. But since those LED’s are quite bright it would be hard to see them flashing and would appear steady, try recording the LEDs with a cellphone camera with a 60FPS or faster or better with a scope.

LEDs flashing at 33Hz

LEDs flashing at 33Hz

The next step would be to solder the 2-row male headers into the Arduino on the following location shown below

Solder the Arduino into the carrier board.

Install the fiber optic light guide and fix it over the TP5100 LEDs with a hot-melt glue as shown below.

The LCD/button shield needs to be modified a bit as per instruction. This requires that the plastic in the headers on both sides be removed and the pins will need to be shortened by few millimeters so that it would mount flush in the carrier board via the female headers.

Trim the excess button wires and apply a small capton tape on the underside of the buttons this will prevent the buttons from shorting into the capacitor that is on the carrier board. What happens during my testing is that whenever I press a button the LCD backlight would turn off immediately.

Programming the firmware

If you’re using Windows you can use Xloader to upload the included firmware. For Linux I use avrdude.

Locate serial port

Plug your arduino to your computer and check the kernel message using dmesg look for something ‘ttyUSBx’

$ dmesg
[84192.594379] usb 1-1: new full-speed USB device number 5 using xhci_hcd
[84192.743985] usb 1-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[84192.743991] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[84192.743995] usb 1-1: Product: USB2.0-Serial
[84193.452284] usbcore: registered new interface driver usbserial_generic
[84193.452317] usbserial: USB Serial support registered for generic
[84193.459371] usbcore: registered new interface driver ch341
[84193.459975] usbserial: USB Serial support registered for ch341-uart
[84193.460653] ch341 1-1:1.0: ch341-uart converter detected
[84193.469498] usb 1-1: ch341-uart converter now attached to ttyUSB0
[84294.017798] usb 1-1: USB disconnect, device number 5
[84294.018263] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[84294.018303] ch341 1-1:1.0: device disconnected
[84579.191795] usb 1-9: reset full-speed USB device number 4 using xhci_hcd
[85197.612929] usb 1-1: new full-speed USB device number 6 using xhci_hcd
[85197.762523] usb 1-1: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54
[85197.762530] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[85197.762534] usb 1-1: Product: USB2.0-Serial
[85197.764473] ch341 1-1:1.0: ch341-uart converter detected
[85197.765826] usb 1-1: ch341-uart converter now attached to ttyUSB0

Upload firmware to Arduino

sudo avrdude -p ATmega2560 -P /dev/ttyUSB0 -c wiring -U flash:w:LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex -D

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex"
avrdude: input file LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex auto detected as Intel Hex
avrdude: writing flash (47294 bytes):

Writing | ################################################## | 100% 7.33s

avrdude: 47294 bytes of flash written
avrdude: verifying flash memory against LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex:
avrdude: load data flash data from input file LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex:
avrdude: input file LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex auto detected as Intel Hex
avrdude: input file LRTimelapse_Pro_Timer_MAX_LCD_V1_25.hex contains 47294 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 5.65s

avrdude: verifying ...
avrdude: 47294 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, H:D8, L:FF)

avrdude done.  Thank you.

Turning on

Issues with the LCD button

One issue I encountered was that most of the buttons in my LCD were not working, it was because of some versions of the LCD shield output a different voltage from its voltage divider circuit. This is easily fixed by enabling and disabling some “define” statements in the source code . This will use the correct voltage readout for those versions of LCD.

Timelapse demo

I did mess up the interval on this one, the interval was too short for shutter speed needed during the magic hour, I had to make changes in qDSLRDashboard w/c showed up as a sudden change in the speed of the clouds.

Updated firmware

As of this writing, I’ve already updated the firmware to v1.27 which Hans gladly provided to me when I discussed some issue running my version of LCD shield. It includes “Focus Stacking” improvement which I’m not currently using, if your primary usage is just Holy grail timelapse v1.25 would suffice. Just contact Hans to get the latest

]]>
Make KSGER safe https://j3ffrw.github.io/posts/2020-11-13-make_ksger_safe/ Fri, 13 Nov 2020 00:31:19 +0800 https://j3ffrw.github.io/posts/2020-11-13-make_ksger_safe/ Since this unit comes in different version and configuration you’ll need to make sure which of the changes apply to your unit. This steps were performed on the the following configuration of Ksger T12 Soldering station. Hardware Version 2.1S PSU version v2.

Since this unit comes in different version and configuration you’ll need to make sure which of the changes apply to your unit.

This steps were performed on the the following configuration of Ksger T12 Soldering station.

  • Hardware Version 2.1S
  • PSU version v2.04
  • Aluminum case

What needs to be improved

  • Improve isolation of heatsink from high voltage track
  • Grounding of Encoder, GX12-5M shell, and casis.
  • Add transient protection diode
  • Improve display alignment.

Improve PCB high voltage track isolation from heatsink.

Using capton tape as additional layer

Using capton tape as additional layer

Grounding of Encoder and GX12-5M

Adding a transient protection diode.

Improve OLED Display alignment w/ front panel.

To make the front pcb more parallel with the front panelI’ve added a spacer (a piece of solid wire) on the encoder side. Other option was to desoldered the GX12-5M and relocate the washer to the front side, but this one requires a lot of effort. The display was resoldered so that would sit more closely with the cutout in the front panel

Reference:

t12-stm32-v2-1s-soldering-station-controller-schematic-etc

modifying-the-ksger-t12-to-make-it-safe

]]>
DIY solder fume extractor https://j3ffrw.github.io/p509/ Mon, 21 Sep 2020 00:31:19 +0800 https://j3ffrw.github.io/p509/ Most desktop solder fume extractor that is available doesn’t work well, to suck in the fumes they either need to be very close or need to be on top of the parts your soldering. The filter that came with those extractor doesn’t work either, they are too porous to be able to properly filter the fumes. As an alternative, I’ve repurposed an air purifier as a fume extractor by fitting it with an adjustable duct. Most desktop solder fume extractor that is available doesn’t work well, to suck in the fumes they either need to be very close or need to be on top of the parts your soldering. The filter that came with those extractor doesn’t work either, they are too porous to be able to properly filter the fumes. As an alternative, I’ve repurposed an air purifier as a fume extractor by fitting it with an adjustable duct.

Materials:

To mount the duct to the purifier I used a half side of a tool and bore a hole just enough for the duct to fit in. This will need to be reinforced since the duct is quite heavy and will need to glue in to stay in position.

Since the purifier I’m using lets air in on its side, I have covered it with an EVA foam and leave an opening just enough for the duct to increase the airflow in the duct even at low speed.

To hold the assembly to the purifier I’m using a racheting nylon strap which is good enough for now, but might have to find a better solution so that I could mount it vertically.

Here’s the extractor in action.

References:

]]>
Replacing a Leaking Plug Cylinder Head on a Honda Jazz GD1 https://j3ffrw.github.io/p508/ Tue, 01 Sep 2020 10:31:19 +0800 https://j3ffrw.github.io/p508/ To remove the plug you’ll need to pry it off little by little on all sides using a small flat screwdriver. Chances are the plastic is brittle and when you try to pry it on one side one of the tabs might break off and will fall inside which is bad. Clean the dried oil on the surface of the hole, use a scrub pad if necessary.

To remove the plug you’ll need to pry it off little by little on all sides using a small flat screwdriver. Chances are the plastic is brittle and when you try to pry it on one side one of the tabs might break off and will fall inside which is bad.

Clean the dried oil on the surface of the hole, use a scrub pad if necessary.

.Resize "300x"

Install the new plug into the cylinder head. And thats it you’re done.

.Resize "300x"
]]>
Formating Miniware DS213 v1.22 8MB Storage https://j3ffrw.github.io/p507/ Mon, 31 Aug 2020 10:31:19 +0800 https://j3ffrw.github.io/p507/ I initially tried to format the DS213 v1.22 built-in 8MB storage on my linux machine but the files ended up unreadable after saving a few screenshots and CSV. The first method I tried was from the official forum. http://www.minidso.com/forum.php?mod=viewthread&tid=3342&highlight=format, sudo dd of=/dev/sda if=/dev/zero status=progress sudo mkfs.fat -F 12 /dev/sda mkdir -p /tmp/p sudo mount /dev/sda /tmp/p -t msdos -o "fat=12" This essentially formats it to FAT12 but the files are unreadable or corrup once mounted. I initially tried to format the DS213 v1.22 built-in 8MB storage on my linux machine but the files ended up unreadable after saving a few screenshots and CSV. The first method I tried was from the official forum. http://www.minidso.com/forum.php?mod=viewthread&tid=3342&highlight=format,

sudo dd of=/dev/sda if=/dev/zero status=progress
sudo mkfs.fat -F 12 /dev/sda
mkdir -p /tmp/p
sudo mount /dev/sda /tmp/p -t msdos -o "fat=12"

This essentially formats it to FAT12 but the files are unreadable or corrup once mounted.

sudo mkfs.fat -F 12 /dev/sda
mkfs.fat 4.1 (2017-01-24)
sudo file -s /dev/sda
/dev/sda: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", Bytes/sector 4096, sectors/cluster 4, root entries 512, sectors 2048 (volumes <=32 MB), Media descriptor 0xf8, sectors/FAT 1, sectors/track 16, heads 1, serial number 0x6abdcee4, unlabeled, FAT (12 bit)

Searching for a similar issue in the forums suggested to use Win 7 which I did try and that somehow worked. I used Win 7 to format the DS213 storage to FAT(Default) and selecting “Quick Format” http://www.minidso.com/forum.php?mod=viewthread&tid=2079&page=1#pid5441

Checking back on linux to see how the storage was formatted showed that the sectors per cluster was set to one (1).

sudo file -s /dev/sda
/dev/sdb: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "MSDOS5.0", Bytes/sector 4096, root entries 512, sectors 2048 (volumes <=32 MB), Media descriptor 0xf8, sectors/FAT 1, sectors/track 1, heads 1, reserved 0x1, serial number 0x8e66a5cc, unlabeled, FAT (12 bit)

So to make formating of DS213 work in linux and make the files readable was to override mkfs.fat sector per cluster option to one.

sudo mkfs.fat -F 12 -s1 /dev/sda
mkfs.fat 4.1 (2017-01-24)
sudo file -s /dev/sda
/dev/sda: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", Bytes/sector 4096, root entries 512, sectors 2048 (volumes <=32 MB), Media descriptor 0xf8, sectors/FAT 1, sectors/track 16, heads 1, serial number 0x998edf48, unlabeled, FAT (12 bit)

Sample screenshots made within DS213

]]>
AC Cleaning https://j3ffrw.github.io/p506/ Sat, 29 Aug 2020 10:31:19 +0800 https://j3ffrw.github.io/p506/ Now, normally I would hire a professional(someone who does this for a living) as it&rsquo;s cheaper than paying my self on a per hour basis. But with this coronavirus spreading around in my area, the risk of having infected is greater than what I would be losing financially. I heard that you need at least Php 500K to get treated. Cleaning your AC unit should be done at least once or twice a year specifically if it&rsquo;s used daily. Now, normally I would hire a professional(someone who does this for a living) as it’s cheaper than paying my self on a per hour basis. But with this coronavirus spreading around in my area, the risk of having infected is greater than what I would be losing financially. I heard that you need at least Php 500K to get treated.

Cleaning your AC unit should be done at least once or twice a year specifically if it’s used daily. This is to maintain it’s efficiency and prevents it from becoming a breeding ground for molds and bacteria.

WARNING: You need to de-energize the unit before starting any maintenance on it. The unit would be probably damp which makes the risk of electrocution are high. You’ll need to find the circuit breaker where your AC is assigned to and turned it off, it is usually labeled as “ACCU”. Once you have turned the breaker off, verify that the AC is no longer receiving power by trying to turn it on.

Tools and materials you’ll need:

  • AC Cover/Cleaning Bag, I prefer the transparent one as it helps me see what am doing.
  • Plastic
  • Garden hose with adjustable spray nozzle
  • Spray bottle for the coil cleaning solution
  • Screwdriver
  • sponge and rags
  • kitchen faucet adapter, ex. M24 to 3/4”, size depends on your faucet
  • Alkaline-based Coil cleaning solution: Read the label on how to mix this water, you’ll need at least around 800mL solution.

Personal Protection Equipment:

  • Rubber gloves
  • Safety glasses
  • Face mask
  1. To start the disassembly pull the lower part towards you when facing the unit and carefully unlatch it from its hinges on the bottom. This will also reveal the screws that hold the main cover.

  2. Remove the screws from the main cover. The main cover usually latches on the top portion of the bracket, to unlatch it you’ll need to hold it at the lower part and pull it towards you and upwards.

  3. Using a sponge remove the remaining water from the drip pan.

  4. Remove the screws holding the drip pan from the bracket.

  5. Inspect the sides of the drip pan/louver assembly, on the right side you’ll need to disconnect the wirings to the motor and power button. On the left side you’ll need to carefully disconnect the drip pipe line from drip pan.

  6. Remove the drip pan/louver assembly.

  7. Clean the main plastic cover and drip pan/louver assembly and set aside.

  8. Using a plastic bag, cover the electronics on the right side of the unit. Be sure the cover extends fully at the back.

  9. Put on the AC bag cover to the unit. The elastic part of the cover goes toward the backside of the unit.

  10. For the AC cover drain hose, you can either use a pail or just route it outside of the window as I did, just make someone hold it or secure it somehow so that it won’t move out of the position when the water starts draining later.

  11. Do a pre-rinse to remove some of the dirt from the coil and blower fan. The pressure from the faucet should be enough to dislodge most of the dirt from the unit. Never use a fixed pressure washer on the coil as it’s too strong and will damage the coil fin. https://www.speedclean.com/wp-content/uploads/2016/05/Powerwashed-Coil-2-600x600.jpg

  12. Spray the coil cleaner solution on the coil and blower fan. Let it sit for 5 to 10 minutes. It should start making bubbles in a few minutes. Be careful handling this solution though this alkaline based, it will still cause some irritation when it gets in contact with your skin or eyes.

  13. Rinse out the solution with water and inspect to see if there are remaining dirt. You might need to reapply the solution a second time to soften up stubborn dirt. Rinse afterward.

  14. Once done with the final rinse. Let the unit dry off, use an electric fan to speed up the process.

  15. While waiting for the indoor unit to dry off, do clean the outside unit’s coil using the cleaning solution and water no need to disassemble anything.

  16. Once the indoor unit is almost dry, reassemble the main cover and drip pan back into the indoor unit.

]]>
Integrate staticman to a hugo themes https://j3ffrw.github.io/p505/ Wed, 12 Aug 2020 10:31:19 +0800 https://j3ffrw.github.io/p505/ Setup up backend related stuff: github, heruko, staticman(backend) https://travisdowns.github.io/blog/2020/02/05/now-with-comments.html#configuring-staticmanyml Integrate staticman frontend to a hugo themes: post(single) https://dancwilliams.com/hugo-staticman-nested-replies-and-email-notifications/# Note: things note covered above. include the counterpart of staticman &ldquo;path&rdquo; to config.yml [data] comments = &quot;data/comments/{options.entryId}&quot; Setup up backend related stuff: github, heruko, staticman(backend) https://travisdowns.github.io/blog/2020/02/05/now-with-comments.html#configuring-staticmanyml

Integrate staticman frontend to a hugo themes: post(single) https://dancwilliams.com/hugo-staticman-nested-replies-and-email-notifications/#

Note: things note covered above.

  1. include the counterpart of staticman “path” to config.yml
[data]
  comments = "data/comments/{options.entryId}"
]]>
Ruckus Zap and Speedflex test setup https://j3ffrw.github.io/p504/ Wed, 29 Jul 2020 10:31:19 +0800 https://j3ffrw.github.io/p504/ Buid zap tool. link Install Ruckus Speedlflex on Node #1 and #2. Test basic connectivity between Node #1 and #2 using the app Speedflex itself . On the control(laptop), run zap client $ ./bin/linux/zap -s192.168.1.3 -d192.168.1.4 ./bin/linux/zap version 1.83, Copyright ( C ) 2004-2009 Ruckus Wireless, Inc. All Rights Reserved.
  1. Buid zap tool. link

  2. Install Ruckus Speedlflex on Node #1 and #2.

  3. Test basic connectivity between Node #1 and #2 using the app Speedflex itself

    Node #1 configuration

    .

    Node #2 configuration

  4. On the control(laptop), run zap client

$ ./bin/linux/zap -s192.168.1.3 -d192.168.1.4
./bin/linux/zap version 1.83, Copyright ( C ) 2004-2009 Ruckus Wireless, Inc. All Rights Reserved.
Built Jul 29 2020 at 10:29:36
Engaging default options -p50000 -n1000 -l1472 -q0x0

    0: 192.168.1.3->192.168.1.4    233=rx   0=dr   0=oo   0=rp   233=rx in    51.7ms    53.0mbps    53.0 | 53.0 53.0 53.0 53.0 53.0 53.0
    1: 192.168.1.3->192.168.1.4    546=rx   0=dr   0=oo   0=rp   313=rx in    50.3ms    73.2mbps    63.1 | 73.2 53.0 53.0 53.0 53.0 53.0
    2: 192.168.1.3->192.168.1.4    628=rx   0=dr   0=oo   0=rp    82=rx in    59.6ms    16.2mbps    47.5 | 73.2 53.0 16.2 16.2 16.2 16.2
    3: 192.168.1.3->192.168.1.4    769=rx   0=dr   0=oo   0=rp   141=rx in    68.1ms    24.4mbps    41.7 | 73.2 24.4 16.2 16.2 16.2 16.2
    4: 192.168.1.3->192.168.1.4   1081=rx   0=dr   0=oo   0=rp   312=rx in    50.7ms    72.5mbps    47.9 | 73.2 53.0 16.2 16.2 16.2 16.2
    5: 192.168.1.3->192.168.1.4   1337=rx   0=dr   0=oo   0=rp   256=rx in    50.3ms    59.9mbps    49.9 | 73.2 53.0 16.2 16.2 16.2 16.2
    6: 192.168.1.3->192.168.1.4   1547=rx   0=dr   0=oo   0=rp   210=rx in    51.2ms    48.3mbps    49.6 | 73.2 53.0 16.2 16.2 16.2 16.2
    7: 192.168.1.3->192.168.1.4   1790=rx   0=dr   0=oo   0=rp   243=rx in    71.9ms    39.8mbps    48.4 | 73.2 48.3 16.2 16.2 16.2 16.2
    8: 192.168.1.3->192.168.1.4   1909=rx   0=dr   0=oo   0=rp   119=rx in    50.8ms    27.6mbps    46.1 | 73.2 48.3 16.2 16.2 16.2 16.2
    9: 192.168.1.3->192.168.1.4   2097=rx   0=dr   0=oo   0=rp   188=rx in    85.8ms    25.8mbps    44.1 | 73.2 39.8 16.2 16.2 16.2 16.2
   10: 192.168.1.3->192.168.1.4   2104=rx   0=dr   0=oo   0=rp     7=rx in    80.1ms     1.0mbps    40.2 | 73.2 39.8 16.2  1.0  1.0  1.0
   11: 192.168.1.3->192.168.1.4   2127=rx   0=dr   0=oo   0=rp    23=rx in    96.3ms     2.8mbps    37.0 | 73.2 27.6  2.8  1.0  1.0  1.0
  1. How to analyze result http://www.enterprisenetworkingplanet.com/netos/article.php/3861171/Zap-Provides-Open-Source-Wireless-Testing.htm http://www.revolutionwifi.net/revolutionwifi/2012/01/measuring-wi-fi-performance-using.html
]]>
Apache Benchmark cache buster https://j3ffrw.github.io/p503/ Sat, 18 Apr 2020 00:10:00 +0800 https://j3ffrw.github.io/p503/ Allows ab to bypass or invalidate cdn/web cache by passing random parameters Shortcut using docker https://github.com/j3ffrw/httpd/tree/cache_buster/2.4/alpine Details of building Apache Benchmarch(httpd) from source Linux Mint 19.1 Build openssl wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1e.tar.gz tar xvzf openssl-1.1.1e.tar.gz cd openssl-1.1.1e mkdir /opt/ssl ./config --prefix=/opt/ssl --openssldir=/opt/ssl no-ssl2 shared zlib make -j4 make install Test openssl LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ssl/lib /opt/ssl/bin/openssl version -a echo &quot;&quot; | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ssl/lib /opt/ssl/bin/openssl s_client -connect www.google.com:443 Build httpd 2.4.43 wget https://downloads.apache.org//httpd/httpd-2.4.43.tar.gz tar xvzf httpd-2. Allows ab to bypass or invalidate cdn/web cache by passing random parameters

Shortcut using docker

https://github.com/j3ffrw/httpd/tree/cache_buster/2.4/alpine

Details of building Apache Benchmarch(httpd) from source

Linux Mint 19.1

  1. Build openssl
wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1e.tar.gz
tar xvzf openssl-1.1.1e.tar.gz

cd openssl-1.1.1e
mkdir /opt/ssl
./config --prefix=/opt/ssl --openssldir=/opt/ssl no-ssl2 shared zlib
make -j4
make install
  1. Test openssl
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ssl/lib /opt/ssl/bin/openssl version -a
echo "" | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ssl/lib /opt/ssl/bin/openssl s_client -connect www.google.com:443
  1. Build httpd 2.4.43
wget https://downloads.apache.org//httpd/httpd-2.4.43.tar.gz
tar xvzf httpd-2.4.43.tar.gz

cd httpd-2.4.43/srclib
wget https://downloads.apache.org//apr/apr-1.7.0.tar.gz
tar xvzf apr-1.7.0.tar.gz
ln -s apr-1.7.0 apr
wget https://downloads.apache.org//apr/apr-util-1.6.1.tar.gz
tar xvzf apr-util-1.6.1.tar.gz
ln -s apr-util-1.6.1 apr-util
cd ..
# Apply ab.c.patch if desired
# https://github.com/j3ffrw/httpd/blob/cache_buster/2.4/alpine/ab.c.patch

./configure --with-included-apr --enable-static-ab --with-ssl=/opt/ssl/ --enable-ssl-staticlib-deps --enable-mods-static=ssl --enable-ssl
make -j4
  1. Test ab
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib ./support/ab -V

References: https://chrismiles.livejournal.com/21720.html https://rainbow.chard.org/2012/09/14/using-ab-to-benchmark-with-different-or-random-requests/

]]>
Migrating wordpress to Hugo https://j3ffrw.github.io/p502/ Sun, 05 Jan 2020 00:10:00 +0000 https://j3ffrw.github.io/p502/ Use https://github.com/SchumacherFM/wordpress-to-hugo-exporter Convert posts to page bundle https://gohugo.io/content-management/page-bundles/ cd content/posts find . -maxdepth 1 -type f | grep -v index | while read line; do echo $line; mkdir ${line%%\.md}; mv $line ${line%%\.md}/index.md;done Cleanup each post, convert image reference to shortcode equivalent vim search and replace snippets %s/^M//g %s/&amp;gt;/&gt;/g %s/&amp;lt;/&lt;/g %s/\\_/_/g %s/&amp;#8217;/'/g %s/&amp;#8211;/-/g %s/&lt;\/p&gt;//g %s/&lt;p&gt;//g %s/&lt;/pre&gt;//g %s/&amp;#8220;/&quot;/g %s/&amp;#8221;/&quot;/g %s/&lt;br\ \/&gt;//g Deploy at last. https://gohugo.io/hosting-and-deployment/hosting-on-github/ References:
  • Use https://github.com/SchumacherFM/wordpress-to-hugo-exporter

  • Convert posts to page bundle https://gohugo.io/content-management/page-bundles/

  • cd content/posts
    find . -maxdepth 1 -type f | grep -v index | while read line; do echo $line; mkdir ${line%%\.md}; mv $line ${line%%\.md}/index.md;done
    
    1. Cleanup each post, convert image reference to shortcode equivalent vim search and replace snippets
    %s/^M//g
    %s/&gt;/>/g
    %s/&lt;/</g
    %s/\\_/_/g
    %s/&#8217;/'/g
    %s/&#8211;/-/g
    %s/<\/p>//g
    %s/<p>//g
    %s/</pre>//g
    %s/&#8220;/"/g
    %s/&#8221;/"/g
    %s/<br\ \/>//g
    
    1. Deploy at last. https://gohugo.io/hosting-and-deployment/hosting-on-github/

    References:

    https://laurakalbag.com/processing-responsive-images-with-hugo/

    https://gohugo.io/hosting-and-deployment/hosting-on-github/

    ]]>
    Determine w/c ssh public key was used to login https://j3ffrw.github.io/p501/ Fri, 27 Apr 2018 15:10:00 +0000 https://j3ffrw.github.io/p501/ Generate fingerprint per key while read l; do [[ -n $l &amp;&amp; ${l###} = $l ]] &amp;&amp; ssh-keygen -l -f /dev/stdin &lt;&lt;&lt;$l; done &lt; .ssh/authorized_keys Match fingerprint on /var/log/secure AUTHORIZED_FP=`while read l; do [[ -n $l &amp;&amp; ${l###} = $l ]] &amp;&amp; ssh-keygen -l -f /dev/stdin &lt;&lt;&lt;$l; done &lt; /home/centos/.ssh/authorized_keys 2&gt;/dev/null | grep RSA` sudo cat /var/log/secure |grep &#34;Accepted publickey&#34; | while read line; do AUDIT_MESSAGE=`echo $line | awk -F&#34; &#34; &#39;{print $1 &#34; &#34; $2 &#34; &#34; $3 &#34; from &#34; $11 &#34; FP: &#34; $16}&#39;` AUDIT_FP=`echo $AUDIT_MESSAGE | awk -F&#34; &#34; &#39;{print $7}&#39;` #echo &#34;$AUDIT_FP&#34; MATCHED=`printf &#34;$AUTHORIZED_FP&#34; | grep -n $AUDIT_FP` if [[ &#34;$?
  • Generate fingerprint per key

    while read l; do
      [[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l;
    done < .ssh/authorized_keys

  • Match fingerprint on /var/log/secure

    AUTHORIZED_FP=`while read l; do [[ -n $l && ${l###} = $l ]] && ssh-keygen -l -f /dev/stdin <<<$l; done < /home/centos/.ssh/authorized_keys 2>/dev/null | grep RSA`
    sudo cat /var/log/secure |grep "Accepted publickey" | while read line; do
      AUDIT_MESSAGE=`echo $line | awk -F" " '{print $1 " " $2 " " $3 " from " $11 " FP: " $16}'`
      AUDIT_FP=`echo $AUDIT_MESSAGE | awk -F" " '{print $7}'`
      #echo "$AUDIT_FP"
      MATCHED=`printf "$AUTHORIZED_FP" | grep -n $AUDIT_FP`
      if [[ "$?" == "0" ]]; then
        KEY_LINE=`echo $MATCHED | awk -F":" '{print $1}'`
        KEY_USER=`echo $MATCHED | awk -F" " '{print $3}'`
        #echo $KEY_USER`
        echo "$AUDIT_MESSAGE User: $KEY_LINE $KEY_USER"
      fi
    done

  • ]]>
    How to use Chipkit’s Max32 as USB Adapter for Xbee radios https://j3ffrw.github.io/p485/ Wed, 01 Jan 2014 04:31:26 +0000 https://j3ffrw.github.io/p485/ Here&rsquo;s an alternative way of hooking up your xbee to your computer using your existing Max32 or any 3.3V arduino-compatible boards. Xbee to Max32 DOUT ------ 1(TX0) DIN ------ 0(RX0) VCC ------ 3.3V GND ------ GND RST to GND ( This is to deactivate the max32 mcu) Ref: Arduino Uno to Xbee Parallax XBee USB Adapter Board http://www.parallax.com/product/32400 Using X-CTU on linux http://lizard43.blogspot.com/2008/10/x-ctu-with-linux.html Chipkit Max32 Schematics http://www.digilentinc.com/Data/Products/CHIPKIT-MAX32/chipKIT%20Max32_bysa_sch.pdf Here’s an alternative way of hooking up your xbee to your computer using your existing Max32 or any 3.3V arduino-compatible boards.

    Xbee   to   Max32 
    DOUT ------ 1(TX0)
    DIN  ------ 0(RX0)
    VCC  ------ 3.3V
    GND  ------ GND
    RST to GND ( This is to deactivate the max32 mcu)
    

    Ref:

    Arduino Uno to Xbee

    Parallax XBee USB Adapter Board

    http://www.parallax.com/product/32400

    Using X-CTU on linux

    http://lizard43.blogspot.com/2008/10/x-ctu-with-linux.html

    Chipkit Max32 Schematics

    http://www.digilentinc.com/Data/Products/CHIPKIT-MAX32/chipKIT%20Max32_bysa_sch.pdf

    ]]>
    Online Electronics Shop/Seller in the Philippines https://j3ffrw.github.io/p479/ Sat, 21 Dec 2013 18:25:03 +0000 https://j3ffrw.github.io/p479/ www.e-gizmo.com www.circuit-help.com.ph www.innovationph.com/ www.relixtechnologies.com/ http://www.tipidpc.com/useritems.php?username=relixtech www.gadgetpinas.ph http://www.tipidpc.com/useritems.php?username=SOMASEGAR (Arduino’s and raspberry pi) http://www.dynamodo.com http://nipahut.com.ph/index.html http://ph.element14.com/ http://depmechatronics.wordpress.com/ http://www.newportelec.com/ic.html http://www.dynamodo.com/ www.e-gizmo.com

    www.circuit-help.com.ph

    www.innovationph.com/

    www.relixtechnologies.com/ http://www.tipidpc.com/useritems.php?username=relixtech

    www.gadgetpinas.ph http://www.tipidpc.com/useritems.php?username=SOMASEGAR (Arduino’s and raspberry pi)

    http://www.dynamodo.com

    http://nipahut.com.ph/index.html

    http://ph.element14.com/

    http://depmechatronics.wordpress.com/

    http://www.newportelec.com/ic.html

    http://www.dynamodo.com/

    ]]>
    a random thought https://j3ffrw.github.io/p470/ Sun, 24 Nov 2013 13:12:31 +0000 https://j3ffrw.github.io/p470/ ]]> Things to backup in linux after installation https://j3ffrw.github.io/p460/ Sat, 02 Nov 2013 04:46:11 +0000 https://j3ffrw.github.io/p460/ Partition mkdir ~/backup; cd ~/backup sfdisk -d /dev/sdx &gt; sfdisk_dump fdisk -l /dev/sda &gt; fdisk_listing LVM metadata backup vgcfgbackup; cp /etc/lvm/backup/vg_groupname ~/backup LUKS header locate partition(s) with luks using blkid fdisk -l 2&gt;&amp;1 | cut -d' ' -f1 | grep &quot;\/dev&quot; | while read line; do blkid -p $line | grep crypto | cut -d: -f1; done or using cryptsetup fdisk -l 2&gt;&amp;1 | cut -d' ' -f1 | grep &quot;\/dev&quot; | while read line; do cryptsetup isLuks $line; if [ $? Partition

    mkdir ~/backup; cd ~/backup
    sfdisk -d /dev/sdx > sfdisk_dump
    fdisk -l /dev/sda > fdisk_listing

    LVM metadata backup

    vgcfgbackup; cp /etc/lvm/backup/vg_groupname ~/backup

    LUKS header

    1. locate partition(s) with luks using blkid fdisk -l 2>&1 | cut -d' ' -f1 | grep "\/dev" | while read line; do blkid -p $line | grep crypto | cut -d: -f1; done or using cryptsetup fdisk -l 2>&1 | cut -d' ' -f1 | grep "\/dev" | while read line; do cryptsetup isLuks $line; if [ $? = 0 ]; then echo "luks found on $line"; fi done

    2. actual backup cryptsetup luksHeaderBackup --header-backup-file luksHeaderBackup /dev/sdx#

    NOTE: be sure to secure luksHeader by encrypting it using gpg -c luksHeaderBackup

    ]]>
    convert a bootable ISO-13346 (UDF) to ISO-9660 https://j3ffrw.github.io/p452/ Mon, 22 Jul 2013 10:51:36 +0000 https://j3ffrw.github.io/p452/ this is useful when you virtualbox is complaining about VBOX_E_IPRT_ERROR when using an iso file to install a guest OS(Windows 7) mkdir -p isos/mountp cp udfimage.iso isos cd isos geteltorito udfimage.iso &amp;gt; boot.bin mount -o loop -t auto udfimage.iso mountp cp -r mountp udfimagecontents cp boot.bin udfimagecontents mkisofs -udf -b boot.bin -no-emul-boot -hide boot.bin -relaxed-filenames -joliet-long -D -o newimage.iso udfimagecontents reference: http://poppleit.com/how-to-edit-windows-7-install-dvd-extract-boot-image-and-create-iso-04-04-2011/ this is useful when you virtualbox is complaining about VBOX_E_IPRT_ERROR when using an iso file to install a guest OS(Windows 7)

    mkdir -p isos/mountp
    cp udfimage.iso isos
    cd isos
    geteltorito udfimage.iso &gt; boot.bin
    mount -o loop -t auto udfimage.iso mountp
    cp -r mountp udfimagecontents
    cp boot.bin udfimagecontents
    mkisofs -udf -b boot.bin -no-emul-boot -hide boot.bin -relaxed-filenames -joliet-long -D -o newimage.iso udfimagecontents

    reference: http://poppleit.com/how-to-edit-windows-7-install-dvd-extract-boot-image-and-create-iso-04-04-2011/

    ]]>
    generating(self-signed) and enabling SSL in Apache https://j3ffrw.github.io/p443/ Wed, 19 Jun 2013 03:55:08 +0000 https://j3ffrw.github.io/p443/ #generate SSL cert for apache openssl version OpenSSL 1.0.0-fips 29 Mar 2010 cd /etc/pki/tls/certs openssl genrsa -out mycert.pem 2048 ls -alh mycert.* openssl req -new -key mycert.pem -out mycert.csr ls -alh mycert.* openssl x509 -req -days 365 -in mycert.csr -signkey mycert.pem -out mycert.crt ls -alh mycert.* cp mycert.pem mycert.csr /etc/pki/tls/private/ # A single SSL enabled virtual host httpd-2.2.15-28.el6.centos.i686 mySslEnabledVirtHost.conf LoadModule ssl_module modules/mod_ssl.so Listen 443 SSLPassPhraseDialog builtin SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000) SSLSessionCacheTimeout 300 SSLMutex default SSLRandomSeed startup file:/dev/urandom 256 SSLRandomSeed connect builtin SSLCryptoDevice builtin &lt;VirtualHost _default_:443&gt; SSLEngine on SSLCertificateFile /etc/pki/tls/certs/mycert. #generate SSL cert for apache

    openssl version

    OpenSSL 1.0.0-fips 29 Mar 2010

    cd /etc/pki/tls/certs
    openssl genrsa -out mycert.pem 2048
    ls -alh mycert.*
    openssl req -new -key mycert.pem -out mycert.csr
    ls -alh mycert.*
    openssl x509 -req -days 365 -in mycert.csr -signkey mycert.pem -out mycert.crt
    ls -alh mycert.*
    cp mycert.pem mycert.csr /etc/pki/tls/private/

    # A single SSL enabled virtual host

    httpd-2.2.15-28.el6.centos.i686

    mySslEnabledVirtHost.conf

    LoadModule ssl_module modules/mod_ssl.so
    Listen 443
    SSLPassPhraseDialog  builtin
    SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
    SSLSessionCacheTimeout  300
    SSLMutex default
    SSLRandomSeed startup file:/dev/urandom  256
    SSLRandomSeed connect builtin
    SSLCryptoDevice builtin
    
    <VirtualHost _default_:443>
            SSLEngine on
            SSLCertificateFile /etc/pki/tls/certs/mycert.crt
            SSLCertificateKeyFile /etc/pki/tls/private/mycert.pem
            <Directory /var/www/myweb>
                    AllowOverride All
            </Directory>
            DocumentRoot /var/www/myweb
            ServerName subdomain.mydomain.com:443
    </VirtualHost>
    
    ]]>
    Election day fixing day. https://j3ffrw.github.io/p404/ Wed, 15 May 2013 06:57:28 +0000 https://j3ffrw.github.io/p404/ What better things to do during election day than fixing things up. List of things to fix: Canon EF-S 18-55mm 3.6-5.6 IS stock lens – problem: auto focus kaput Quantaray LD 70-300mm – problem: auto focus kaput. Let&rsquo;s start off with quantaray. This one seems to have gear problem since when it tries to drive the focus you could only hear the motor whirl freely. What better things to do during election day than fixing things up.

    List of things to fix:

    1. Canon EF-S 18-55mm 3.6-5.6 IS stock lens – problem: auto focus kaput

    2. Quantaray LD 70-300mm – problem: auto focus kaput.

    Let’s start off with quantaray.

    This one seems to have gear problem since when it tries to drive the focus you could only hear the motor whirl freely.

    The cause of the problem was that the gear’s upper tooth on the right were all strip, I don’t know what cause this, since the lens is not mine and was borrowed from my uncle.

    A workaround is to swap the gears position since both are identical and the second gear position seems to not use those tooth anyway.

    Test shot @70mm

    Test shot @300mm

    @17mm on a different lens

    Test shot @300mm

    As for the canon lens the Focus FPC has split into two and needs replacement.

    ]]>
    Pfsense + Freeradius + dd-wrt WPA2 Enterprise. https://j3ffrw.github.io/p385/ Thu, 02 May 2013 11:27:16 +0000 https://j3ffrw.github.io/p385/ Here&rsquo;s a simple setup to demonstrate WPA2-ENT authentication using a Username/Password pair. This blog will be mostly screenshot with little description on what it does, since there are lots of explanation being offered on the web. check my references at the end of this post. Network diagram: Requirements: Pfsense &ndash; for this demonstration i was using 2.1-BETA1 Freeradius &ndash; 1.6.7 pfsense package Wifi Access point &ndash; buffalo whz-hp-g300nh2 running on ddwrt. Here’s a simple setup to demonstrate WPA2-ENT authentication using a Username/Password pair.

    This blog will be mostly screenshot with little description on what it does, since there are lots of explanation being offered on the web. check my references at the end of this post.

    Network diagram:

    Requirements:

    Pfsense – for this demonstration i was using 2.1-BETA1

    Freeradius – 1.6.7 pfsense package

    Wifi Access point – buffalo whz-hp-g300nh2 running on ddwrt. (any AP should work as long it is capable using WPA Ent.)

    Any WPA/WPA2 compliant client. – Laptop with Windows 7.

    Procedure:

    A: Generate Certificates Needed.

    1. Login to pfsense web interface and go to Certificate Manager.

    2. Create CA.

    3. Create Server Certificate.

    B: Configure Freeraduis on pfsense.

    1. Go to Services -> Freeradius.

    2. Create a User. username: wifiUser1 password: 123456

    3. Create an authenticator entry in NAS/Client. IP: 10.0.1.150 , Client Shared Secret: myApSecret

      On the screenshot below I also added several entries which I use for troubleshooting and testing freeradius. For this demonstration we only need the 10.0.1.150

    4. Create an interface.

    5. Configure EAP.

    C. Configure Access Point

    D. Import of CA.crt to Windows 7

    1. Export CA.crt from pfsense Certificate Manager.

    2. Import CA.crt into MMC Certificate add-in. Be sure to import it in “Trusted Root Certification Authorities”

    Once you connect to your Access point you just configured windows will require you to enter a Username and Password, use the one we have made above. You will also get a warning stating that the Certificate is invalid or is unknown, just select Connect on that part since were using a self-signed certificate.

    References:

    http://doc.pfsense.org/index.php/FreeRADIUS_2.x_package#EAP-TLS

    http://www.smallnetbuilder.com/wireless/wireless-howto/30213-how-to-setting-up-freeradius-for-wpa-a-wpa2-enterprise-part-2

    ]]>
    Basic Stamp 2e IR Remote Decoder https://j3ffrw.github.io/p375/ Tue, 30 Apr 2013 14:05:40 +0000 https://j3ffrw.github.io/p375/ Purpose: Remote control decoder Status: * Decoding part &ndash; done. Encoding part &ndash; not working &ndash; I need to check the 555 timer via scope(which i dont have) to verify the modulated frequency. BOM: 1 BASIC Stamp 2e processor PBASIC; variant Basic Stamp 2e 1 Electrolytic Capacitor package 100 mil [THT, electrolytic]; capacitance 1µF; voltage 6.3V 1 Ceramic Capacitor package 100 mil [THT, multilayer]; capacitance 0.01µF; voltage 6. Purpose: Remote control decoder

    Status: * Decoding part – done.

    • Encoding part – not working – I need to check the 555 timer via scope(which i dont have) to verify the modulated frequency.

    BOM:

    • 1 BASIC Stamp 2e processor PBASIC; variant Basic Stamp 2e
    • 1 Electrolytic Capacitor package 100 mil [THT, electrolytic]; capacitance 1µF; voltage 6.3V
    • 1 Ceramic Capacitor package 100 mil [THT, multilayer]; capacitance 0.01µF; voltage 6.3V
    • 1 TSOP312.., 314.. package THT; row single; pin spacing 0.1in (2.54mm); pins 3
    • 1 Infrared LED - 5mm package 5 mm [THT]; leg yes; color Infrared (940nm)
    • 1 150 Ω Resistor package THT; tolerance ±5%; bands 4; resistance 150Ω; pin spacing 400 mil
    • 3 220 Ω Resistor package THT; tolerance ±5%; bands 4; resistance 220Ω; pin spacing 400 mil
    • 1 470 Ω Resistor package THT; tolerance ±5%; bands 4; resistance 470Ω; pin spacing 400 mil
    • 1 Rotary Potentiometer (Small) maximum resistance 10kΩ
    • 1 555 Timer package DIP8 [THT]

    Schematic

    Captured IR code using a IR phototransistor connected to a PC/Laptop sound card.

    Sample decoding session using Basic Stamp Editor debug terminal.

    Measuring Start bit:
    Press several random keys 15 times at least 1 second apart
    15 of 15
    Start pulse range: uS , units
    LOW: 2916us - 3672us , 1474-1842
    High: 4104us - 4104us , 2059-2062
    Skip pulse histogram:[Y/n] n
    Press a several random keys repeatedly
    00: Width units         0       Width us        0-36     60
    12: Width units         216     Width us        432-468  25
    13: Width units         234     Width us        468-504  37
    14: Width units         252     Width us        504-540  12
    15: Width units         270     Width us        540-576  2
    16: Width units         288     Width us        576-612  3
    17: Width units         306     Width us        612-648  6
    43: Width units         774     Width us        1548-1584       20
    44: Width units         792     Width us        1584-1620       204
    45: Width units         810     Width us        1620-1656       14
    62: Width units         1116    Width us        2232-2268       105
    Enter low bit max width (in cycles,see histogram): 288
    Enter high bit max width (in cycles,see histogram): 810
    Press a key to decode
    Bit Count: 32
    LSB to MSB: %11111101 %00000010 %00000111 %00000111 FD020707
    Transmit code LSB->MSB:[Y/n] n
    Retransmit code LSB->MSB:[Y/n] n
    Bit Count: 32
    LSB to MSB: %11111011 %00000100 %00000111 %00000111 FB040707
    Transmit code LSB->MSB:[Y/n] n
    Retransmit code LSB->MSB:[Y/n] n
    Bit Count: 33
    LSB to MSB: %11111011 %00000100 %00000111 %00000111 FB040707
    Transmit code LSB->MSB:[Y/n]
    
    ]]>
    Enable brightness function keys https://j3ffrw.github.io/p370/ Thu, 28 Mar 2013 10:48:03 +0000 https://j3ffrw.github.io/p370/ insert acpi_backlight=vendor option into grub. update-grub2 GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2&gt; /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash acpi_backlight=vendor&rdquo; GRUB_CMDLINE_LINUX=&rdquo;&rdquo; insert acpi_backlight=vendor option into grub.

    update-grub2

    GRUB_DEFAULT=0

    GRUB_HIDDEN_TIMEOUT=0

    GRUB_HIDDEN_TIMEOUT_QUIET=true

    GRUB_TIMEOUT=10

    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor”

    GRUB_CMDLINE_LINUX=””

    ]]>
    Disable discreet VGA card in linux mint https://j3ffrw.github.io/p371/ Thu, 28 Mar 2013 10:31:19 +0000 https://j3ffrw.github.io/p371/ Nvidia: sudo rmmod nvidia sudo tee /proc/acpi/bbswitch &lt;&lt;&lt;OFF check the output of dmesg if the ff shows bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF if it does contain the above message, find which application using it and kill it. Then try turning it off again. sudo lsof -n -w -t /dev/nvidia* Nvidia:

    sudo rmmod nvidia
    sudo tee /proc/acpi/bbswitch <<<OFF
    

    check the output of dmesg if the ff shows

    bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF

    if it does contain the above message, find which application using it and kill it. Then try turning it off again.

    sudo lsof -n -w -t /dev/nvidia*

    ]]>
    Dell T110 IPMI 2.0 SOL with CentOS 6.3 https://j3ffrw.github.io/p366/ Fri, 22 Mar 2013 11:20:20 +0000 https://j3ffrw.github.io/p366/ IPMI: Enter Dell&rsquo;s IPMI server management configuration utility. (Ctrl+E) Set &ldquo;IPMI over LAN&rdquo; to &ldquo;On&rdquo;. Configure &ldquo;IPMI LAN Channel&rdquo;, choose either static or dynamic. Set &ldquo;VLAN Enable&rdquo; to &ldquo;Off&rdquo;. Set &ldquo;Administrator Account&rdquo; to &ldquo;Enable&rdquo; Set Username and password. Press Esc key and select Save option. BIOS: Enter Dell&rsquo;s BIOS. (F2) Configure &ldquo;Serial Communication&rdquo; to be &ldquo;On with Console Redirection via COM2&rdquo;. IPMI:

    1. Enter Dell’s IPMI server management configuration utility. (Ctrl+E)

    2. Set “IPMI over LAN” to “On”.

    3. Configure “IPMI LAN Channel”, choose either static or dynamic.

    4. Set “VLAN Enable” to “Off”.

    5. Set “Administrator Account” to “Enable”

    6. Set Username and password.

    7. Press Esc key and select Save option.

    BIOS:

    1. Enter Dell’s BIOS. (F2)

    2. Configure “Serial Communication” to be “On with Console Redirection via COM2”. Dell’s BMC is connected to COM2.

    3. Set “Baud” and “Remote Terminal Type”. “115200”, “VT100/VT220”.

    4. Save and exit.

    CentOS 6.3

    1. Edit /boot/grub/grub.conf using vi/gedit.

    2. Insert the ff lines below “hiddenmenu” option. This redirect console to 2nd serial port(COM2) where BMC is connected.

    serial --unit=2 --speed=115200
    terminal --timeout=8 console serial
    
    1. Comment out splashimage.
    #splashimage=(hd0,0)/grub/splash.xpm.gz
    
    1. Append the ff lines to kernel options
    console=tty0 console=ttyS1,115200n8
    
    kernel /vmlinuz-2.6.9-42.0.10.ELsmp ro root=LABEL=/ console=tty0 console=ttyS1,19200n8
    
    1. Save and exit.

    Testing.

    On another terminal connect using the ff command.

    ipmitool -I lanplus -H <IPofServerIPMI> -U user -a sol activate

    Ref:

    http://www.symantec.com/connect/articles/how-do-sol-serial-over-lan-aka-console-redirection-dell-servers

    http://www.dell.com/downloads/global/power/ps4q04-20040204-murphy.pdf

    http://www.cyberciti.biz/faq/linux-serial-console-howto/

    http://lonesysadmin.net/2007/06/21/how-to-configure-ipmi-on-a-dell-poweredge-running-red-hat-enterprise-linux/

    ]]>
    add multiple email forwarders using AutoIt https://j3ffrw.github.io/p363/ Thu, 21 Mar 2013 09:01:16 +0000 https://j3ffrw.github.io/p363/ #include &lt;string.au3&gt; #include &lt;Array.au3&gt; #Include &lt;File.au3&gt; #Include &lt;FF.au3&gt; #include &lt;Date.au3&gt; Global $Paused HotKeySet(&#34;{PAUSE}&#34;, &#34;TogglePause&#34;) HotKeySet(&#34;{ESC}&#34;, &#34;Terminate&#34;) $emailList=&#34;emaillist.csv&#34; $fowardEmailto=&#34;[email protected]&#34; $cpanelEmailForwardingPage=&#34;https://yourcpanel.com:2082/cpsess8672753610/frontend/x3/mail/addfwd.html&#34; _FFConnect() if _FFIsConnected() Then ; do nothing Else ConsoleWrite(&#34;Not Connected &#34; &amp; @CRLF) EndIf ; check file if it exist $file = FileOpen($emailList,0) if $file=-1 Then MsgBox(0,&#34;error&#34;,&#34;File does not exist or cant be read&#34;) Exit EndIf ; open file containing emails and put contents to an array Dim $aRecords _FileReadToArray($emailList,$aRecords) MsgBox(0, &#34;&#34;, &#34;size: &#34; &amp; $aRecords[0]) For $x=1 to $aRecords[0] _FFOpenURL($cpanelEmailForwardingPage) If($aRecords[$x] &lt;&gt; $fowardEmailto) Then writeForwarder($aRecords[$x]) EndIf Next Exit Func writeForwarder($email) $temp1 = StringSplit($email, &#34;@&#34;) ConsoleWrite(&#34;email: &#34; &amp; $email &amp; @CRLF) ConsoleWrite(&#34;name: &#34; &amp; $temp1[1] &amp; @CRLF) ConsoleWrite(&#34;domain: &#34; &amp; $temp1[2] &amp; @CRLF) ; Enter email on field _FFSetValue($temp1[1], &#34;email&#34;, &#34;id&#34;) ; Enter email domain on select dropdown box $test2=&#39;//select[@name=&#34;domain&#34;]//option[@value=&#34;&#39; &amp; $temp1[2] &amp; &#39;&#34;]&#39; _FFXPath($test2, &#39;selected=true&#39;, 9) ; Enter emaill address to forward email _FFSetValue($fowardEmailto, &#34;fwdemail&#34;, &#34;id&#34;) ; submit fom _FFFormSubmit() ;Sleep(2000) EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(100) ToolTip(&#39;Script is &#34;Paused&#34;&#39;,0,0) WEnd EndFunc Func Terminate() Exit 0 EndFunc
    #include <string.au3>
    #include <Array.au3>
    #Include <File.au3>
    #Include <FF.au3>
    #include <Date.au3>
    
    Global $Paused
    HotKeySet("{PAUSE}", "TogglePause")
    HotKeySet("{ESC}", "Terminate")
    
    $emailList="emaillist.csv"
    $fowardEmailto="[email protected]"
    $cpanelEmailForwardingPage="https://yourcpanel.com:2082/cpsess8672753610/frontend/x3/mail/addfwd.html"
    
    _FFConnect()
    
    if _FFIsConnected() Then
    	; do nothing
    Else
    	
    	ConsoleWrite("Not Connected " & @CRLF)
    EndIf
    
    ; check file if it exist
    $file = FileOpen($emailList,0) 
    
    if $file=-1 Then
    	MsgBox(0,"error","File does not exist or cant be read")
    	Exit
    EndIf
    
    ; open file containing emails and put contents to an array
    Dim $aRecords
    
    _FileReadToArray($emailList,$aRecords)
    
    MsgBox(0, "", "size: " & $aRecords[0])
    
    For $x=1 to $aRecords[0]
    	_FFOpenURL($cpanelEmailForwardingPage)
       If($aRecords[$x] <> $fowardEmailto) Then
    	  writeForwarder($aRecords[$x])
       
    	EndIf
    Next
    
    Exit
    
    Func writeForwarder($email)
    	$temp1 = StringSplit($email, "@")
    	ConsoleWrite("email: " & $email & @CRLF)
    	ConsoleWrite("name: " & $temp1[1] & @CRLF)
    	ConsoleWrite("domain: " & $temp1[2] & @CRLF)
    	
    	; Enter email on field
    	_FFSetValue($temp1[1], "email", "id")
    	
    	; Enter email domain on select dropdown box
    	$test2='//select[@name="domain"]//option[@value="' & $temp1[2] & '"]'
        _FFXPath($test2, 'selected=true', 9)
    	
    	; Enter emaill address to forward email
    	_FFSetValue($fowardEmailto, "fwdemail", "id")
    	
    	; submit fom
    	_FFFormSubmit()
    	
    	;Sleep(2000)
    EndFunc
    
    Func TogglePause()
    	$Paused = NOT $Paused
    	While $Paused
    		Sleep(100)
    		ToolTip('Script is "Paused"',0,0)
    		WEnd
    	EndFunc
    	
    Func Terminate()
    	Exit 0
    	EndFunc
    ]]>
    Tower of hanoi v.1 https://j3ffrw.github.io/p333/ Thu, 21 Feb 2013 10:30:08 +0000 https://j3ffrw.github.io/p333/ v.1 using iterative solution todo: v.2 shorten code. v.3 use recursion import java.util.logging.Level; import java.util.logging.Logger; /* * To change this template, choose Tools | Templates * and open the template in the editor. * even: right side move. * odd: left side move. */ /** * * @author Jefferson M. Fermo * * Iterative solution of tower of Hanoi. * * */ public class Hanoi { private Peg[] pegs; private final int NUMBEROFTOWERS = 3; private boolean directionOfMoveIsRight = false; private long numberOfMoves = 0; private int discCount = 0; int currentPeg = 0; int lastPegMove = 0; int moves = 0; public Hanoi(int discCount) throws Exception { this. v.1 using iterative solution

    todo:

    v.2 shorten code.

    v.3 use recursion

    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     * even: right side move.
     * odd: left side move.
     */
    
    /**
     *
     * @author Jefferson M. Fermo 
     * 
     * Iterative solution of tower of Hanoi.
     * 
     * 
     */
    public class Hanoi {
    
        private Peg[] pegs;
        
        private final int NUMBEROFTOWERS = 3;
        
        private boolean directionOfMoveIsRight = false;
        
        private long numberOfMoves = 0;
        
        private int discCount = 0;
        
        int currentPeg = 0;
            
        int lastPegMove = 0;
        
        int moves = 0;
        
        public Hanoi(int discCount) throws Exception {
            
            this.discCount = discCount;
            
            // (N^2)-1
            numberOfMoves = (long) Math.pow(2, discCount)-1;
            
            System.out.println("moves: " + numberOfMoves);
            
            
            // determine the movement of disc based on its quantity.
            if (discCount % 2 == 1) {
                System.out.println("odd");
                directionOfMoveIsRight = false;
            }else{
                System.out.println("even");
                directionOfMoveIsRight = true;
            }            
            
            pegs = new Peg[NUMBEROFTOWERS];
            
            // create pegs with slots equal to the total number of disc.
            for (int cntr = 0; cntr &lt; NUMBEROFTOWERS; cntr++) {
                pegs[cntr] = new Peg(discCount);
            }
            
            
            for (int cntr = 0; cntr &lt; discCount; cntr++) {
                Disc disc = new Disc(discCount-cntr);
                
                pegs[0].populatePeg(disc);
            }
            
            System.out.println("Initial content");
            
            for (Peg peg1 : pegs) {
                    System.out.println(peg1);
            }
            
            System.out.println("**************");
            
            //System.out.println("next peg transfer disc #" + nextPeg(pegs[1]).getPegNumber());
            
            
        }
        
        public void solve() throws Exception{
            
            for (moves = 0; moves &lt; numberOfMoves; ) {
                
                Peg peg = pegs[currentPeg];
                
                moveDiscFromPeg(peg);
                
                if ((currentPeg == 0 & lastPegMove == 2) | (currentPeg == 2 & lastPegMove == 0)) {
                    currentPeg = 1;
                }else if((currentPeg == 0 & lastPegMove == 1) | (currentPeg == 1 & lastPegMove == 0)){
                    currentPeg = 2;
                }else if((currentPeg == 1 & lastPegMove == 2) | (currentPeg == 2 & lastPegMove == 1)){
                    currentPeg = 0;
                }
                
            }
            
            for (Peg peg1 : pegs) {
                System.out.println(peg1);
            }
            
        }
        
        
        private int moveDiscFromPeg(Peg currentPeg) throws Exception{
        
            int invalidNextPeg = 0;
            
            int movesMade = 0;
            
            Peg peg = currentPeg;
            
            int lastPeg = 0;
            
            // there are only 2 possible moves in a 3 tower.
            while (invalidNextPeg &lt;= 2) {         
                
                Peg nextPeg = nextPeg(peg);
                
                if (currentPeg.getPegNumber() == nextPeg.getPegNumber()) {
                    return movesMade;
                }
                
                //System.out.println("is move legal? " + currentPeg.getPegNumber() + ", " + nextPeg.getPegNumber());
                
                if (isNextMoveLegal(currentPeg, nextPeg)){
                    
                    moveDisk(currentPeg, nextPeg);
                                    
                    moves++;
                    
                    invalidNextPeg = 0;
                    
                    lastPegMove = nextPeg.getPegNumber();
                    
                }else{
                    
                    invalidNextPeg++;
                    
                }
                
                peg = nextPeg;            
            }
        
            System.out.println("last peg: " + lastPeg);
                
            
            return movesMade;
        }
        
        /**
         * Checks if the move is legal from source to destination peg.
         * A move is legal if the following has been met:
         * 1. source peg contains a disc and destination peg is empty.
         * 2. disc at the top of destination peg is bigger than the disc on top of source peg. Both pegs are not empty.
         * A move is considered invalid if:
         * 3. source peg does not contain a disc and destination contains a disc.
         * 4. disc at the top of destination peg is smaller than the disc on top of source peg. Both pegs are not empty.
         * 5. both pegs does not contain a disc.
         * 
         * @param sourcePeg Peg where disc will be taken
         * @param destPeg   Peg where disc will be placed
         * @return  returns true if move is legal based on rule #1 and #2
         */
        
        private boolean isNextMoveLegal(Peg sourcePeg, Peg destPeg){
            
            // rule #1
            if (destPeg.getTopIndex() == -1 & sourcePeg.getTopIndex() != -1) {
                return true;
            // rule #3    
            }else if(sourcePeg.getTopIndex() == -1 & destPeg.getTopIndex() != -1){
                return false;
            }else if(sourcePeg.getTopIndex() != -1 && destPeg.getTopIndex() != -1){
                Disc sourceDisk = sourcePeg.readTopDisc();
                Disc destDisk = destPeg.readTopDisc();
                
                //rule #2
                if (destDisk.getSize() &gt; sourceDisk.getSize()) {
                    return true;
                //rule #4
                }else{
                    return false;
                }
            //rule #5    
            }else if(sourcePeg.getTopIndex() == -1 & destPeg.getTopIndex() == -1){
                return false;
            }
            
            return false;
            
        }
        
        private Peg nextPeg(Peg currentPeg){
        
            int pegNumber = currentPeg.getPegNumber();
            
            int nextPegNumber = 0;
            
            if (directionOfMoveIsRight) {
                int tmp = pegNumber + 1;
                
                if (tmp &lt; 3) {
                    nextPegNumber = tmp;
                }else{
                    nextPegNumber = 0;
                }
            }else{
                int tmp = pegNumber - 1;
                
                if (tmp &lt; 0) {
                    nextPegNumber = 2;
                }else{
                    nextPegNumber = tmp;
                }
            }
            
            return pegs[nextPegNumber];
        }
        
        private boolean moveDisk(Peg sourcePeg, Peg destinationPeg) throws Exception{
        
            Disc disc = sourcePeg.getDisk();
            
            destinationPeg.putDisc(disc);        
            
            return false;
        }
        
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            try {
                // create 3 towers(default) with disc from 1 to 25 ascending.
                Hanoi hanoi = new Hanoi(25);
                
                hanoi.solve();
                
            } catch (Exception ex) {
                Logger.getLogger(Hanoi.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    
    
    class Peg{
    
        private Disc[] disc;
        
        private int topIndex = -1;
        
        private int discCount = 0;
        
        private static int pegNumber = 0;
        
        private int myPegNumber = 0;
        
        Peg(int discCount){
            disc = new Disc[discCount];
            this.discCount = discCount;
            myPegNumber = pegNumber++;
        }
    
        public Disc readTopDisc(){
            
            if (topIndex == -1) {
                return null;
            }else{
                return disc[topIndex];
            }
            
        }
    
        public int getTopIndex() {
            return topIndex;
        }
        
        public Disc getDisk(){
            
            if (topIndex == -1) {
                return null;
            }else{
                Disc disk = this.disc[topIndex];
                this.disc[topIndex] = null;
                topIndex--;
                return disk;
            }
        }
        
        public void populatePeg(Disc disc) throws Exception{
            
            if (topIndex &lt;= discCount) {
                topIndex++;
                
                this.disc[topIndex] = disc;
                System.out.print("Added disk #" + disc.getSize() + " at :" + topIndex + "\n");
                
            }else{
                throw new Exception("Peg overflowed with disk");
            }
        }
        
        public void putDisc(Disc disc) throws Exception{
            
            if (topIndex &lt;= discCount) {
                topIndex++;
                
                this.disc[topIndex] = disc;
                //System.out.print("Added disk #" + disc + " at P" + myPegNumber + ":" + topIndex + "\n");
                
            }else{
                throw new Exception("Peg overflowed with disk");
            }
        }
    
        public int getPegNumber() {
            return myPegNumber;
        }
        
        
        @Override
        public String toString(){
        
            StringBuilder string = new StringBuilder();
            
            string = string.append("\nPeg #").append(myPegNumber).append("\t");
            
            for (int cntr = 0; cntr &lt;= topIndex; cntr++) {
                string = string.append(disc[cntr].getSize()).append(",");
            }
            
            //string = string.append("\n");
            
            return string.toString();
        }
        
    }
    
    class Disc{
    
        int size;
        
        public Disc(int number) {
            size = number;
        }
    
        public int getSize() {
            return size;
        }
        
        @Override
        public String toString(){
            return "" + size;
        }
        
    }
    ]]>
    make gopenvpn icon show in ubuntu 11.04 and up https://j3ffrw.github.io/p322/ Tue, 19 Feb 2013 11:40:04 +0000 https://j3ffrw.github.io/p322/ gsettings set com.canonical.Unity.Panel systray-whitelist &quot;['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'gopenvpn']&quot; also allow user to sudo gopenvpn and openvpn. gsettings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Mumble', 'Wine', 'Skype', 'gopenvpn']"

    also allow user to sudo gopenvpn and openvpn.

    ]]>
    allow httpd to access fuse mounted folders https://j3ffrw.github.io/p316/ Fri, 08 Feb 2013 09:36:27 +0000 https://j3ffrw.github.io/p316/ Centos 6.3 selinux does not have httpd_use_fusefs in its database here&rsquo;s a quick fix instead of turning off selinux totally. https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow.html here&rsquo;s a good reference about selinux management: http://tag1consulting.com/blog/stop-disabling-selinux Centos 6.3 selinux does not have httpd_use_fusefs in its database here’s a quick fix instead of turning off selinux totally.

    https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Fixing_Problems-Allowing_Access_audit2allow.html

    here’s a good reference about selinux management:

    http://tag1consulting.com/blog/stop-disabling-selinux

    ]]>
    KVM Spice USB-redirection quick speed test https://j3ffrw.github.io/p295/ Mon, 04 Feb 2013 09:51:46 +0000 https://j3ffrw.github.io/p295/ Bare Metal: Write: 22.8MBs Read: 22.0MBs Host to Guest: Write: 6.46MBs Read: 6.36MBs Remote to Guest: Write: 5.00MBs Read: 4.92MBs * via remote-viewer Bare Metal:            Write: 22.8MBs Read: 22.0MBs

    Host to Guest:       Write: 6.46MBs Read: 6.36MBs

    Remote to Guest:  Write: 5.00MBs Read: 4.92MBs * via remote-viewer

    ]]>
    allow non-admin users to run programs to as administrator https://j3ffrw.github.io/p289/ Mon, 04 Feb 2013 08:21:52 +0000 https://j3ffrw.github.io/p289/ use RunasSpc to allow non-admin users to run programs at elevated rights without your password. free for private use. link: http://www.robotronic.de/guidance.html use RunasSpc to allow non-admin users to run programs at elevated rights without your password. free for private use.

    link: http://www.robotronic.de/guidance.html

    ]]>
    KVM notes https://j3ffrw.github.io/p287/ Mon, 28 Jan 2013 07:24:13 +0000 https://j3ffrw.github.io/p287/ For host machine- Centos 6.3 64: KVM installation. http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-6.0-server http://blog.mattbrock.co.uk/2012/02/12/virtualisation-with-kvm-and-lvm-on-centos-6-via-the-command-line/ http://vitobotta.com/setting-up-kvm-lvm-virtual-machine-host/ Using Spice with LibVirt KVM http://wiki.centos.org/HowTos/Spice-libvirt Viewing remote KVM Guest with usb redirection (linux mint maya 64): Option 1: https://launchpad.net/~bderzhavets/+archive/lib-usbredir73 Option 2: Compile spice: wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz wget http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2 ./configure --prefix=/usr http://spice-space.org/download/gtk/spice-gtk-0.16.tar.bz2 ./configure --enable-usbredir=yes --with-python=yes http://spice-space.org/download/releases/spice-protocol-0.12.2.tar.gz install virt-viewer 5.4-3. deb http://ubuntu.mirror.cambrium.nl/ubuntu/ raring main universe libacl1.2.2.51-8 libattr1-1:2.4.46-8ubuntu2 libspice-client-glib-2.0-8 libspice-client-gtk-3.0-4 wget https://launchpad.net/~dnjl/+archive/build/+build/4077605/+files/virt-viewer_0.5.4-3~raring0_amd64.deb Viewing remote KVM Guest with usb redirection using Ubuntu 13.04(live CD): enable universe sources For host machine- Centos 6.3 64:

    KVM installation.

    http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-6.0-server

    http://blog.mattbrock.co.uk/2012/02/12/virtualisation-with-kvm-and-lvm-on-centos-6-via-the-command-line/

    http://vitobotta.com/setting-up-kvm-lvm-virtual-machine-host/

    Using Spice with LibVirt KVM

    http://wiki.centos.org/HowTos/Spice-libvirt

    Viewing remote KVM Guest with usb redirection (linux mint maya 64):

    Option 1:

    https://launchpad.net/~bderzhavets/+archive/lib-usbredir73

    Option 2:

    Compile spice:

    wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
      
    wget http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2 ./configure --prefix=/usr
      
    http://spice-space.org/download/gtk/spice-gtk-0.16.tar.bz2 ./configure --enable-usbredir=yes --with-python=yes
      
    http://spice-space.org/download/releases/spice-protocol-0.12.2.tar.gz

    install virt-viewer 5.4-3.

    deb http://ubuntu.mirror.cambrium.nl/ubuntu/ raring main universe

    libacl1.2.2.51-8

    libattr1-1:2.4.46-8ubuntu2

    libspice-client-glib-2.0-8

    libspice-client-gtk-3.0-4

    wget https://launchpad.net/~dnjl/+archive/build/+build/4077605/+files/virt-viewer_0.5.4-3~raring0_amd64.deb

    Viewing remote KVM Guest with usb redirection using Ubuntu 13.04(live CD):

    enable universe sources

    sudo apt-get update
    sudo apt-get install libapparmor1_2.8 libgtk-vnc-2.0 libgvnc-1.0 libspice-client-glib-2.0 libspice-client-gtk-3.0 libusbredirhost1 libusbredirparser0 libvirt0
    

    now ubuntu 13.04 does have virt-viewer-0.5.4-1 at universe, but this version could not connect to spice type graphics.

    it seems that the binary remote-viewer is not linked libspice-client-glib-2.0. That is why I’ll be using this version virt-viewer_0.5.4-3~raring0_i386.deb from https://launchpad.net/~dnjl/+archive/virtualization.

    wget https://launchpad.net/~dnjl/+archive/build/+build/4077606/+files/virt-viewer_0.5.4-3~raring0_i386.deb
    sudo dpkg -i virt-viewer_0.5.4-3~raring0_i386.deb
    

    Note:

    Install kvm guest(LVM) via KVM

    mkdir /var/www/html/centos
      
    mount -t iso9660 -o loop CentOS-6.3-x86_64-bin-DVD1.iso /var/www/html/centos
      
    virt-install \
      --name=loyalty1 \
      --cpuset=2 --ram=1024 --network bridge=br0 \
      --disk=/dev/volgrp\_kvm\_guest1/swap \
      --disk=/dev/volgrp\_kvm\_guest1/root \
      --disk=/dev/volgrp\_kvm\_guest1/usr \
      --disk=/dev/volgrp\_kvm\_guest1/opt \
      --disk=/dev/volgrp\_kvm\_guest1/var \
      --vnc --noautoconsole \
      --location http://myserver/centos
    

    Install KVM guest(image) via ISO

    virt-install \
      --name=pfsense2 \
      --cpuset=2 \
      --ram=1024 \
      --network bridge=br0 \
      --network bridge=br1 \
      --disk path=/var/lib/libvirt/images/pfsense.img \
      --vnc --noautoconsole --livecd \
      --cdrom /var/lib/libvirt/images/pfsense.iso
    
    ]]>
    my pfsense notes https://j3ffrw.github.io/p275/ Thu, 24 Jan 2013 07:43:33 +0000 https://j3ffrw.github.io/p275/ working folder of ntop, nut, dhcp: /var/db config folder of openvpn, ntp, dns(resolv), snmp, syslog /var/etc working folder of ntop, nut, dhcp:

    /var/db

    config folder of openvpn, ntp, dns(resolv), snmp, syslog

    /var/etc

    ]]>
    Problem logging in from Netbootdisk into smb share after using Samba v3.5.10 https://j3ffrw.github.io/p220/ Tue, 13 Nov 2012 05:46:40 +0000 https://j3ffrw.github.io/p220/ Problem: accounts created by smbpasswd -a does not work with samba-3.5.10-125.el6.x86_64 though it was working fine on a previous version I was using, samba-3.0.33-3.38.el5_8. Both ship with centos 5.8 and centos 6.3 respectively. increasing log level = 3 shows the following error on samba 3.5.10 which where not on 3.0.33 *ntlm_password_check: Lanman passwords NOT PERMITTED for user myuser On the client side, Netbootdisk on my instance, it is saying that my password is invalid. Problem:

    accounts created by smbpasswd -a does not work with samba-3.5.10-125.el6.x86_64 though it was working fine on a previous version I was using, samba-3.0.33-3.38.el5_8. Both ship with centos 5.8 and centos 6.3 respectively.

    increasing log level = 3 shows the following error on samba 3.5.10 which where not on 3.0.33

    *ntlm_password_check: Lanman passwords NOT PERMITTED for user myuser

    On the client side, Netbootdisk on my instance, it is saying that my password is invalid. But on Windows desktop I was able to log in just fine.

    comparing the output of testparm -v on both version shows that samba 3.5.8 change some default settings from lower version if it were not specified on your smb.conf. Particularly the lanman auth was set to No by default which cause the above Lanman passwords NOT PERMITTED … error.

    lower version: lanman auth = Yes

    newer version: lanman auth = No

    After entering lanman auth = Yes into smb.conf

    The error changed to

    *ntlm_password_check: NO LanMan password set for user myuser (and no NT password supplied)

    after fiddling around with the other default settings I was still stuck with that error.Then I decided to issue again the command

    smbpasswd -a myuser

    and this solve my problem I was now able to login into samba 3.5.10 from Netbootdisk like before.

    It seems that smbpasswd will not create a LanMan password if the lanman auth setting was left on its own and you have to reissue that smbpasswd command in case you decided to change lanman auth to Yes it later on.

    Not sure if it were in the release notes I did not bother to read them maybe I should have.

    ]]>
    Ruckus zap tool installation and testing https://j3ffrw.github.io/p217/ Thu, 08 Nov 2012 18:31:19 +0000 https://j3ffrw.github.io/p217/ Update: on 64bit OS edit Makefile after source checkout and remove -m32 Install Ruckus Zap tool on both PC/Laptop, installers can be found Ruckus website. Mac Windows For Linux: you have to compile from source. Open terminal and execute the following commands svn checkout http://zapwireless.googlecode.com/svn/trunk/ zapwireless-read-only # or git clone https://github.com/ryanchapman/zapwireless.git zapwireless-read-only cd zapwireless-read-only make &amp;&amp; make install Run zapd on both PC/Laptop,you should see something like the following. Update: on 64bit OS edit Makefile after source checkout and remove -m32

    1. Install Ruckus Zap tool on both PC/Laptop, installers can be found Ruckus website. Mac Windows For Linux: you have to compile from source. Open terminal and execute the following commands

      svn checkout http://zapwireless.googlecode.com/svn/trunk/ zapwireless-read-only
      # or
      git clone https://github.com/ryanchapman/zapwireless.git zapwireless-read-only
      cd zapwireless-read-only
      make && make install

    2. Run zapd on both PC/Laptop,you should see something like the following.

    zapd version 1.83, Copyright (C) 2004-2009 Ruckus Wireless, Inc.
          
    Built Oct 13 2012 at 11:12:20
          
    Zapd service started
    
    1. To test zap run the following command on either computer. zap -sIpOf1stComputer -dIpOf2ndComputer Zap should run for a number of seconds and you should see something like the following output.
    0: 192.168.1.247->192.168.1.18 403=rx 0=dr 0=oo 0=rp 403=rx in 50.1ms 94.7mbps 94.7 | 94.7 94.7 94.7 94.7 94.7 94.7 
    
    1. If all goes well then zap tool has been properly installed. If not check your firewall if its blocking Zap tool. Also don’t forget to read Zap’s tool Manual regarding changing windows registry to enable TOS bit modification
    ]]>
    zPerf 1.0 (wip) https://j3ffrw.github.io/p201/ Thu, 08 Nov 2012 11:11:29 +0000 https://j3ffrw.github.io/p201/ Purpose: Provides a GUI Frontend for Ruckus amazing Zap tool Visualize Zap tool results using charts. Feature: Generate CDF graph from zap result file. Save graph to image file Requirements: jre6 or higher Ruckus zap tool Download zperf archive: zPerf How to use: Extract zperf archive. Under zperf/bin/ folder, there are the three files, run/use the appropriate file for your OS, zperf - linux, zperf. Purpose:

    • Provides a GUI Frontend for Ruckus amazing Zap tool

    • Visualize Zap tool results using charts.

    Feature:

    • Generate CDF graph from zap result file.
    • Save graph to image file

    Requirements:

    • jre6 or higher
    • Ruckus zap tool

    Download zperf archive: zPerf

    How to use:

    • Extract zperf archive.
    • Under zperf/bin/ folder, there are the three files, run/use the appropriate file for your OS, zperf - linux, zperf.exe - 32bit windows, zperf64.exe, 64bit windows.
    • Enter IP address of both computers running zapd
    • Enter the name of the file where to save result in “Result filename”. This is optional, zPerf with create one if you did not specify.
    • Pres “Run” button

    Screen shots:

    Main User Interface

    Chart Viewer - Split View

    Chart Viewer - Line Chart

    Chart Viewer - Average throughput comparison between traces on a certain probability.

    zPerf process and thread handling was inspired by jperf . I actually copied the source and modified it a bit for my purpose.

    ]]>
    Removing multiple devices in Windows https://j3ffrw.github.io/p192/ Sun, 07 Oct 2012 03:46:14 +0000 https://j3ffrw.github.io/p192/ Device Remover http://www.pro-it-education.de/software/deviceremover/ Device Remover

    http://www.pro-it-education.de/software/deviceremover/

    ]]>
    Scripts, scripts and scripts. https://j3ffrw.github.io/p185/ Fri, 27 Jul 2012 17:27:29 +0000 https://j3ffrw.github.io/p185/ find certain strings in files on certain folders find . -type f ! -exec grep -q '@olddomain.com' {} \; -exec grep -q 'olddomain.com' {} \; -print find . -type f | xargs egrep -Hn '@olddomain.com' search for top talkers using tshark tshark -r output.cap -T fields -e ip.src &quot;tcp.flags.syn==1 &amp;&amp; tcp.flags.ack==0&quot; | sort | uniq -c | sort -rn | head chmod multiples files mix with directory.
  • find certain strings in files on certain folders
  • find . -type f ! -exec grep -q '@olddomain.com' {} \; -exec grep -q 'olddomain.com' {} \; -print

    find . -type f | xargs egrep -Hn '@olddomain.com'

    • search for top talkers using tshark

    tshark -r output.cap -T fields -e ip.src "tcp.flags.syn==1 && tcp.flags.ack==0" | sort | uniq -c | sort -rn | head

    • chmod multiples files mix with directory.

    find /folderpath -type f -exec chmod 644 {} \;

    • chmod multiples directory mix with other files.

    find /folderpath -type d -exec chmod 755 {} \;

    ]]>
    Sending mysql commands with backticks via pssh https://j3ffrw.github.io/p180/ Mon, 23 Jul 2012 02:10:28 +0000 https://j3ffrw.github.io/p180/ pssh -h servers -i 'echo &quot;select * from \`tablename with space\`&quot; | mysql -uusername -ppass database' pssh -h servers -i 'echo "select * from \`tablename with space\`" | mysql -uusername -ppass database'

    ]]>
    when certs are revoke https://j3ffrw.github.io/p166/ Tue, 17 Jul 2012 02:08:50 +0000 https://j3ffrw.github.io/p166/ Jul 17 09:59:23 localhost openvpn[6247]: XX.xx.XX.xx:port Re-using SSL/TLS context Jul 17 09:59:23 localhost openvpn[6247]: XX.xx.XX.xx:port LZO compression initialized Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS\_ERROR: BIO read tls\_read\_plaintext error: error:140890B2:SSL routines:SSL3\_GET\_CLIENT\_CERTIFICATE:no certificate returned Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS Error: TLS object -&gt; incoming plaintext read error Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS Error: TLS handshake failed
    Jul 17 09:59:23 localhost openvpn[6247]: XX.xx.XX.xx:port Re-using SSL/TLS context
      
    Jul 17 09:59:23 localhost openvpn[6247]: XX.xx.XX.xx:port LZO compression initialized
      
    Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS\_ERROR: BIO read tls\_read\_plaintext error: error:140890B2:SSL routines:SSL3\_GET\_CLIENT\_CERTIFICATE:no certificate returned
      
    Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS Error: TLS object -> incoming plaintext read error
      
    Jul 17 09:59:41 localhost openvpn[6247]: XX.xx.XX.xx:port TLS Error: TLS handshake failed
    ]]>
    compiling ffmpeg on centos 6 https://j3ffrw.github.io/p164/ Sat, 02 Jun 2012 10:45:10 +0000 https://j3ffrw.github.io/p164/ requirements: libtool for faad2 a52: ./configure --enable-shared=PKGS faad2: autoreconf -vif ./configure faac: ./bootstrap ./configure --without-mp4v2 --prefix=/usr lamemp3: ./configure --prefix=/usr yasm: .configure &amp;&amp; make &amp;&amp; make install x264: git clone git://git.videolan.org/x264.git ./configure --enable-shared --prefix=/usr make fprofiled make install xvidcore: .configure &amp;&amp; make &amp;&amp; make install ffmpeg: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg cd ffmpeg ./configure --enable-gpl --enable-postproc --enable-nonfree --enable-postproc \ --enable-avfilter --enable-pthreads --enable-libxvid \ --enable-libx264 --enable-libmp3lame --enable-libfaac --disable-ffserver --disable-ffplay requirements: libtool for faad2

    a52:

    ./configure --enable-shared=PKGS

    faad2:

    autoreconf -vif
    ./configure
    

    faac:

    ./bootstrap
    ./configure --without-mp4v2 --prefix=/usr
    

    lamemp3:

    ./configure --prefix=/usr

    yasm:

    .configure && make && make install

    x264:

    git clone git://git.videolan.org/x264.git
    ./configure --enable-shared --prefix=/usr
    make fprofiled
    make install
    

    xvidcore:

    .configure && make && make install

    ffmpeg:

    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
    cd ffmpeg
    ./configure --enable-gpl  --enable-postproc --enable-nonfree --enable-postproc \
    --enable-avfilter --enable-pthreads --enable-libxvid \
    --enable-libx264 --enable-libmp3lame --enable-libfaac --disable-ffserver --disable-ffplay
    
    ]]>
    installing swftools on centos 6 https://j3ffrw.github.io/p153/ Sat, 02 Jun 2012 05:17:00 +0000 https://j3ffrw.github.io/p153/ install pdf2swf dependencies zlib-devel, libjpeg-devel, freetype-devel, giflib-devel wget http://www.swftools.org/swftools-0.9.2.tar.gz&lt;br /&gt; tar xvzf http://www.swftools.org/swftools-0.9.2.tar.gz&lt;br /&gt; cd swftools-0.9.2 Download the latest tarzgzipped version fo xpdf and put it on the swftools lib/pdf folder cd lib/pdf/&lt;br /&gt; wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.03.tar.gz&lt;br /&gt; ./configure&lt;br /&gt; make Before running make install cd swfs&lt;br /&gt; vi Makefile remove the two “rm” lines with -o option as this are invalid make install install pdf2swf dependencies

    zlib-devel, libjpeg-devel, freetype-devel, giflib-devel

    wget http://www.swftools.org/swftools-0.9.2.tar.gz<br /> tar xvzf http://www.swftools.org/swftools-0.9.2.tar.gz<br /> cd swftools-0.9.2

    Download the latest tarzgzipped version fo xpdf and put it on the swftools lib/pdf folder

    cd lib/pdf/<br /> wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.03.tar.gz<br /> ./configure<br /> make

    Before running make install

    cd swfs<br /> vi Makefile

    remove the two “rm” lines with -o option as this are invalid

    make install

    ]]>
    PXE booting CENTOS 6 on Atheros Atl1e using Driver Update Disk https://j3ffrw.github.io/p145/ Wed, 23 May 2012 06:38:52 +0000 https://j3ffrw.github.io/p145/ Download pschaff&rsquo;s driver disk from elrepo, select architecture that match your installer. &lt;br &gt;http://www.elrepo.org/people/pschaff/dud/ the file you&rsquo;ve downloaded should end with &lsquo;.gz&rsquo;. Uncompress that file. &lt;br &gt;gunzip DUP_el6_i686_20120402.iso.gz Create a temp folder. &lt;br &gt;mkdir initrd_update make a copy of that uncompressed file to the folder you have made &lt;br &gt;cp DUP_el6_i686_20120402.iso initrd_update/dd.img enter that folder &lt;br &gt;cd initrd_update run the ff.
  • Download pschaff’s driver disk from elrepo, select architecture that match your installer. <br >http://www.elrepo.org/people/pschaff/dud/

  • the file you’ve downloaded should end with ‘.gz’. Uncompress that file. <br >gunzip DUP_el6_i686_20120402.iso.gz

  • Create a temp folder. <br >mkdir initrd_update

  • make a copy of that uncompressed file to the folder you have made <br >cp DUP_el6_i686_20120402.iso initrd_update/dd.img

  • enter that folder <br >cd initrd_update

  • run the ff. command <br >find . | cpio --quiet -o -H newc | gzip -9 > ./initrd_update.img

  • copy initrd_update.img to your pxe installation folder as dd.iso

  • modify your centos pxe kernel like this. <br >APPEND ksdevice=eth0 initrd=el6-kickstart/initrd.img,el6-kickstart/dd.img

  • that’s should be it. once pxe downloaded initrd.img and dd.img the drive update disk will be automatically be applied.

  • References:

    http://elrepo.org/bugs/view.php?id=215

    http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/sect-Preparing_an_initial_RAM_disk_update-ppc.html

    ]]>
    using sed in bash scripts https://j3ffrw.github.io/p139/ Mon, 21 May 2012 03:40:54 +0000 https://j3ffrw.github.io/p139/ # Inserting a text on a specified line number ex. insert a text in line number 8 sed command &ldquo;8i&rdquo; -e '8i\# PC-Check 7\.03 with net support' special characters like # and . should have a \ suffix. # Insert a blank line on line number -e '8i\\`echo -e '\n\r'`' # to append at end of the file: sed command: $a -e '\$a#HQ to local DVR' # search and replace, ^ - match all words beginning the word specified and replace the matching word, # Inserting a text on a specified line number ex. insert a text in line number 8 sed command “8i”

    -e '8i\# PC-Check 7\.03 with net support'

    special characters like # and . should have a \ suffix.

    # Insert a blank line on line number

    -e '8i\\`echo -e '\n\r'`'

    # to append at end of the file: sed command: $a

    -e '\$a#HQ to local DVR'

    # search and replace, ^ - match all words beginning the word specified and replace the matching word,

    -e 's/^DNAT/#DNAT/g'

    # search and replace whole line: .* - match all lines containing the word being search and replace the whole line.

    -e 's/.*DNAT.*/#DNAT/g'

    ]]>
    gpg notes https://j3ffrw.github.io/p124/ Tue, 08 May 2012 11:03:09 +0000 https://j3ffrw.github.io/p124/ compress multiple files and encrypt using gpg tar -cv folder | gpg -e -r recipientGpgKey -o output.tar.gpg to decompress the above file:(prepare recipientGpgKey passphrase ) gpg --output output.tar --decrypt output.tar.gpg you must specify –secret-keyring pathtokeyring if secret key is not available on the machine compress multiple files and encrypt using gpg

    tar -cv folder | gpg -e -r recipientGpgKey -o output.tar.gpg

    to decompress the above file:(prepare recipientGpgKey passphrase )

    gpg --output output.tar --decrypt output.tar.gpg

    you must specify –secret-keyring pathtokeyring if secret key is not available on the machine

    ]]>
    Fwknopd with SPA, Part 2. https://j3ffrw.github.io/p78/ Sat, 15 Oct 2011 10:41:28 +0000 https://j3ffrw.github.io/p78/ View both keys with gpg --list-keys $ gpg --list-keys pub 1024D/AAAAAAAA 2008-03-07 uid test fwknop &lt;[email protected]&gt; sub 2048g/DDDDDDDD 2008-03-07 Export both keys from remote and local terminals. gpg -a --export AAAAAAAA &gt; remote.asc gpg -a --export BBBBBBBB &gt; local.asc where AAAAAAAA is the remote key id and BBBBBBBB is the local key id. securely transfer remote.asc to local terminal. securely transfer local.asc to remote terminal. import and signed both keys, you will need to enter the correct passphrase when signing both keys.
    View both keys with gpg --list-keys
    
    $ gpg --list-keys
      
    pub 1024D/AAAAAAAA 2008-03-07
      
    uid test fwknop <[email protected]>
      
    sub 2048g/DDDDDDDD 2008-03-07
    
    Export both keys from remote and local terminals.
    
    gpg -a --export AAAAAAAA > remote.asc
      
    gpg -a --export BBBBBBBB > local.asc

    where AAAAAAAA is the remote key id and BBBBBBBB is the local key id.

    securely transfer remote.asc to local terminal.

    securely transfer local.asc to remote terminal.

    import and signed both keys, you will need to enter the correct passphrase when signing both keys.

    on local terminal

    $ gpg --import remote.asc
    $ gpg --edit-key AAAAAAAA
    Command> sign
    Command> save

    on remote terminal

    $ gpg --import local.asc
    $ gpg --edit-key BBBBBBBB
    Command> sign
    Command> save
    ]]>
    fwknopd with SPA Part.1 https://j3ffrw.github.io/p76/ Sat, 15 Oct 2011 10:29:57 +0000 https://j3ffrw.github.io/p76/ Generate gpg keys on both remote and local terminal : `gpg --gen-key` Please select what kind of key you want: Select (1) DSA and Elgamal (default) What keysize do you want? (2048) Choose default 2048(just press enter) Key is valid for? (0) press enter key does not expire Is this correct? (y/N) press y Real name: enter key name e.g: term-Gpg Email address: enter email... Comment: optional press enter if none Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
    Generate gpg keys on both remote and local terminal :
    
    `gpg --gen-key`
      
    Please select what kind of key you want:
      
    Select (1) DSA and Elgamal (default)
    
    What keysize do you want? (2048)
      
    Choose default 2048(just press enter)
    
    Key is valid for? (0)
      
    press enter key does not expire
    
    Is this correct? (y/N)
      
    press y
    
    Real name:
      
    enter key name e.g: term-Gpg
    
    Email address:
      
    enter email...
    
    Comment:
      
    optional press enter if none
    
    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
      
    press O and enter
    
    You need a Passphrase to protect your secret key.
      
    enter your ultra duper secure passpharse.
    
    generate some activity on the terminal,move your mouse or search for a file. while it generates random bytes.
    
    # finally if all goes well, the ff will be shown.
    
    public and secret key created and signed.
    
    gpg: checking the trustdb
      
    gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
      
    gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
      
    pub 1024D/YYYYXXXX 2011-06-03
            
    Key fingerprint = 1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa
      
    uid Term7-Gpg <[email protected]>
      
    sub 2048g/XXXXYYY 2011-06-03
    ]]>
    installing oflademo on red5 https://j3ffrw.github.io/p72/ Fri, 16 Sep 2011 08:54:04 +0000 https://j3ffrw.github.io/p72/ wget http://trac.red5.org/downloads/1_0/red5-1.0.0-RC1.tar.gz tar xvzf red5-1.0.0-RC1.tar.gz cd red5-1.0.0/webapps/ mkdir oflaDemo cd oflaDemo wget http://red5.googlecode.com/svn-history/r3990/snapshots/oflaDemo-r3989-java6.war unzip oflaDemo-r3989-java6.war cd ../.. ./red5.sh
    wget http://trac.red5.org/downloads/1_0/red5-1.0.0-RC1.tar.gz
    tar xvzf red5-1.0.0-RC1.tar.gz
    cd red5-1.0.0/webapps/
    mkdir oflaDemo
    cd oflaDemo
    wget http://red5.googlecode.com/svn-history/r3990/snapshots/oflaDemo-r3989-java6.war
    unzip oflaDemo-r3989-java6.war
    cd ../..
    ./red5.sh
    ]]>
    Kernel not loading usbserial on Huawei modems https://j3ffrw.github.io/p69/ Wed, 14 Sep 2011 10:29:30 +0000 https://j3ffrw.github.io/p69/ remove pl2303 and usb_storage driver rmmod pl2303&lt;br /&gt; rmmod usb_storage&lt;br /&gt; then reinsert huawei modem again remove pl2303 and usb_storage driver

    rmmod pl2303<br /> rmmod usb_storage<br />

    then reinsert huawei modem again

    ]]>
    Common AT commands https://j3ffrw.github.io/p67/ Mon, 12 Sep 2011 05:08:38 +0000 https://j3ffrw.github.io/p67/ Read all SMS in text mode: AT+CMGF=1 (set TEXT MODE) AT+CMGL=&#34;ALL&#34; Read single sms in text mode: AT+CMGF=1 # (set TEXT MODE) AT+CMGR=1 # (location index) Delete single sms: AT+CMGD=1 # (location index) Sending SMS in text mode: AT+CMGF=1 (set TEXT MODE) AT+CMGS=&#34;0912xxxyyyy&#34; &gt; test message Press Ctrl+z Press Enter Read Sim Number: AT+CPBS=&#34;ON&#34; AT+CPBR=1 +CPBR: 1,&#34;+63948xxxyyyy&#34;,145,&#34;&#34;;
    Read all SMS in text mode:
      
    AT+CMGF=1 (set TEXT MODE)
      
    AT+CMGL="ALL"
    
    Read single sms in text mode:
      
    AT+CMGF=1 # (set TEXT MODE)
      
    AT+CMGR=1 # (location index)
    
    Delete single sms:
      
    AT+CMGD=1 # (location index)
    
    Sending SMS in text mode:
      
    AT+CMGF=1 (set TEXT MODE)
      
    AT+CMGS="0912xxxyyyy"
      
    > test message
      
    Press Ctrl+z
      
    Press Enter
    
    Read Sim Number:
      
    AT+CPBS="ON"
      
    AT+CPBR=1
      
    +CPBR: 1,"+63948xxxyyyy",145,"";
    ]]>
    Setup apache to handle Eric Blue’s Document Browser 1.0 https://j3ffrw.github.io/p64/ Mon, 29 Aug 2011 08:39:54 +0000 https://j3ffrw.github.io/p64/ Download doc_browser http://eric-blue.com/projects/docbrowser/doc_browser_1_0.zip Extract contents to a directory named projects/docbrowser Create the ff. doc.conf inside apache conf.d cat &gt;/etc/apache/conf.d &lt;&lt;EOL Alias /projects /var/www/projects&lt;/p&gt; &lt;p&gt;&lt;Location /projects&gt;&lt;br /&gt; Order allow,deny&lt;br /&gt; Allow from all&lt;br /&gt; &lt;/Location&gt;&lt;/p&gt; &lt;p&gt;&lt;Directory /var/www/projects&gt;&lt;br /&gt; Options +ExecCGI&lt;br /&gt; AddHandler cgi-script .cgi .pl&lt;br /&gt; &lt;/Directory&gt;&lt;br /&gt; EOL Ensure that list.cgi and convert.cgi have execute permission enabled. those script requires the ff.
  • Download doc_browser http://eric-blue.com/projects/docbrowser/doc_browser_1_0.zip

  • Extract contents to a directory named projects/docbrowser

  • Create the ff. doc.conf inside apache conf.d

    cat >/etc/apache/conf.d <<EOL
    Alias /projects /var/www/projects</p>
    <p><Location /projects><br />
        Order allow,deny<br />
        Allow from all<br />
    </Location></p>
    <p><Directory /var/www/projects><br />
    Options +ExecCGI<br />
    AddHandler cgi-script .cgi .pl<br />
    </Directory><br />
    EOL

  • Ensure that list.cgi and convert.cgi have execute permission enabled.

  • those script requires the ff. perl module

    perl-HTML-Entities-Numbered (centos 5.6 base repo)

    perl-Log-Log4perl (rpmforge)

    perl-CGI

    ]]>
    Allow normal user to run smartd in pfsense 1.2.3 https://j3ffrw.github.io/p60/ Fri, 19 Aug 2011 10:10:52 +0000 https://j3ffrw.github.io/p60/ chmod 4555 /usr/local/sbin/smartctl chmod 4555 /usr/local/sbin/smartctl

    ]]>
    SMARTD on zabbix https://j3ffrw.github.io/p46/ Sun, 12 Dec 2010 12:43:17 +0000 https://j3ffrw.github.io/p46/ UserParameter=system.smartd[*],sudo smartctl -A $1| grep $2| tail -1| cut -c 88-|cut -f1 -d&#34; &#34; zabbix ALL=NOPASSWD: /usr/sbin/smartctl
    UserParameter=system.smartd[*],sudo smartctl -A $1| grep $2| tail -1| cut -c 88-|cut -f1 -d" "
    
    zabbix ALL=NOPASSWD: /usr/sbin/smartctl
    ]]>
    lm_sensors 3.20 w/ coretemp using CENTOS 5.5 on GA-G31M-E2SL w/ it8718 chip https://j3ffrw.github.io/p44/ Sun, 12 Dec 2010 07:07:46 +0000 https://j3ffrw.github.io/p44/ add elrepo to your repositories yum &ndash;enablerepo=elrepo install kmod-coretemp # this will install lm_sensor 2.10.8 as its dependencies. lsmod | grep coretemp # coretemp should be loaded by now download latest lm_sensors 3.20 source, compile and install edit /etc/init.d/lm_sensors entry from : PSENSORS=/usr/bin/sensors to: PSENSORS=/usr/local/bin/sensors chkconfig lm_sensors on done modinfo it87 modinfo coretemp optional
  • add elrepo to your repositories

  • yum –enablerepo=elrepo install kmod-coretemp # this will install lm_sensor 2.10.8 as its dependencies.

  • lsmod | grep coretemp # coretemp should be loaded by now

  • download latest lm_sensors 3.20 source, compile and install

  • edit /etc/init.d/lm_sensors entry

      from : PSENSORS=/usr/bin/sensors
      to: PSENSORS=/usr/local/bin/sensors

  • chkconfig lm_sensors on

  • done

      modinfo it87
      
      modinfo coretemp

  • optional

    1. add the ff. to your zabbix_agent.conf

      UserParameter=sensors[\*],/usr/local/bin/sensors | grep "$1" | head -$2 | tail -1 | awk "{print $"$3"}" | sed 's/[-!@#\$%^&\*()°+a-zA-Z]//g'

    2. add the ff to your sensors3.conf under the chip it87 entry

    label fan1 “CPU Fan”

    ]]>
    Mozilla’s ubuntu ppa’s https://j3ffrw.github.io/p36/ Sat, 26 Jun 2010 03:39:18 +0000 https://j3ffrw.github.io/p36/ to get the latest versions of firefox and thunderbird for ubuntu do the ff sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa sudo apt-get update sudo apt-get install thunderbird sudo apt-get install firefox to get the latest versions of firefox and thunderbird for ubuntu do the ff

    sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa

    sudo apt-get update

    sudo apt-get install thunderbird

    sudo apt-get install firefox

    ]]>
    Elrepo https://j3ffrw.github.io/p35/ Wed, 26 May 2010 03:35:25 +0000 https://j3ffrw.github.io/p35/ hardware drivers http://elrepo.org hardware drivers

    http://elrepo.org

    ]]>
    NUT https://j3ffrw.github.io/p31/ Wed, 26 May 2010 03:33:52 +0000 https://j3ffrw.github.io/p31/ Compile NUT from source groupadd nut;adduser -g nut ups yum install gd-devel libusb-devel ./configure --with-user=ups --with-group=nut --with-usb --with-cgi --prefix=/ups --localstatedir=/ups/var --with-pidpath=/ups/var/state/ups --with-statepath=/ups/var/state/ups --enable-static make make install cd /ups;mkdir -p /ups/var/state/ups;chmod 0770 /ups/var/state/ups;chown root:nut /ups/var/state/ups copy libz.so to /ups/lib copy libz.a to /ups/lib chmod 0660 /dev/ttyS0;chown root:nut /dev/ttyS0 cat &gt;/etc/udev/rules.d/99-my.rules &lt;&lt;EOL SUBSYSTEM==&#34;tty&#34;, KERNEL==&#34;ttyS0&#34;, OWNER=&#34;root&#34;, GROUP=&#34;nut&#34; EOL For APC UPS BR550I or BR550GI use the ff. vi /etc/udev/rules.d/52-nut-usbups.rules # This file is generated and installed by the Network UPS Tools package.
  • Compile NUT from source
  •   
    groupadd nut;adduser -g nut ups
      
    yum install gd-devel libusb-devel
      
    ./configure --with-user=ups --with-group=nut --with-usb --with-cgi --prefix=/ups --localstatedir=/ups/var --with-pidpath=/ups/var/state/ups --with-statepath=/ups/var/state/ups --enable-static
    
    make
      
    make install
      
    cd /ups;mkdir -p /ups/var/state/ups;chmod 0770 /ups/var/state/ups;chown root:nut /ups/var/state/ups
      
    copy libz.so to /ups/lib
      
    copy libz.a to /ups/lib
      
    chmod 0660 /dev/ttyS0;chown root:nut /dev/ttyS0
    
    cat >/etc/udev/rules.d/99-my.rules <<EOL
    SUBSYSTEM=="tty", KERNEL=="ttyS0", OWNER="root", GROUP="nut"
    EOL

    For APC UPS BR550I or BR550GI use the ff.

    vi /etc/udev/rules.d/52-nut-usbups.rules
    # This file is generated and installed by the Network UPS Tools package.
    ACTION!="add", GOTO="nut-usbups_rules_end"
    SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
    SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
    BUS!="usb", GOTO="nut-usbups_rules_end"
    LABEL="nut-usbups_rules_real"
    # APC
    #  various models  - usbhid-ups
    ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="nut"
    LABEL="nut-usbups_rules_end"

    Prepare upsd.conf upsmon.conf ups.conf upssched.conf upsd.users

    chown root:nut *.conf upsd.users
      
    chmod 0640 *.conf upsd.users
      

    add the following to /etc/init.d/halt

    LD_LIBRARY_PATH=/ups/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
    if(test -f /etc/killpower)
    then
            echo "***************SHUTTING DOWN UPS*************"
            sleep 1
            echo "5"
            sleep 1
            echo "4"
            sleep 1
            echo "3"
            sleep 1
            echo "2"
            sleep 1
            echo "1"
            sleep 1
            echo "bye!"
            sleep 1
            /ups/bin/upsdrvctl -u root shutdown
            echo "UPS should be off by now"
            sleep 20
    fi
      

    Add upsd upsmon startup scripts to /etc/rc.local

      
    cat >/ups/etc/alerthandler <<EOL
    #! /bin/sh
    case $1 in
            onbattwarn)
                    echo "The UPS has been on battery for awhile"
                    /ups/sbin/upsmon -c fsd
            ;;
            ups-back-on-power)
                    /bin/rm -f /ups/var/state/ups-on-battery
            ;;
            *)
                    logger -t alerthandler "Unrecognized command: $1"
            ;;
            esac
    EOL
    
    chmod 0760 /ups/etc/alerthandler;chown root:nut /ups/etc/alerthandler
      

    TEST

    $ fuser /dev/ttyS0 # should produce no output
      
    $ upsdrvctl start
      
    # Output:
      
    Network UPS Tools - UPS driver controller 2.4.3
      
    Network UPS Tools - Megatec protocol driver 1.6 (2.4.3)
      
    Megatec protocol UPS detected.
      
    $ upsd
      
    # Output:
      
    Network UPS Tools upsd 2.4.3
      
    listening on 127.0.0.1 port 3493
      
    listening on 192.168.1.145 port 3493
      
    Connected to UPS [myups]: megatec-myups
      
      
    $ upsc myups@localhost
      
    # Output:
      
    battery.charge: 100.0
      
    ...
      
    ups.type: standby
    ]]>
    ius repo https://j3ffrw.github.io/p28/ Wed, 26 May 2010 02:28:57 +0000 https://j3ffrw.github.io/p28/ website: http://iuscommunity.org/ download: epel-release-* ; ius-release-* to update PHP: remove rhel packages: rpm -qa | grep php yum shell remove php-gd php-cli php-odbc php-mbstring php-pdo php php-xml php-common php-ldap php-mysql php-imap install php52-gd php52-cli php52-odbc php52-mbstring php52-pdo php52 php52-xml php52-common php52-ldap php52-mysql php52-imap php52-mcrypt transaction solve transaction run website: http://iuscommunity.org/

    download: epel-release-* ; ius-release-*

    to update PHP:

    remove rhel packages:

      
    rpm -qa | grep php
    
    yum shell
    
    remove php-gd php-cli php-odbc php-mbstring php-pdo php php-xml php-common php-ldap php-mysql php-imap
    
    install php52-gd php52-cli php52-odbc php52-mbstring php52-pdo php52 php52-xml php52-common php52-ldap php52-mysql php52-imap php52-mcrypt
    
    transaction solve
    
    transaction run
    ]]>
    Openstreetmap https://j3ffrw.github.io/p17/ Mon, 17 Aug 2009 17:51:09 +0000 https://j3ffrw.github.io/p17/ I just recently joined Openstreetmap.org.ph and now Im totally addicted to it. visit Puerto Princesa using the following links [OpenStreetMap][1] I just recently joined Openstreetmap.org.ph and now Im totally addicted to it. visit Puerto Princesa using the following links

    [OpenStreetMap][1]

    ]]>
    d-txt n electrik fan https://j3ffrw.github.io/p12/ Mon, 18 May 2009 16:16:50 +0000 https://j3ffrw.github.io/p12/ GSM Controller most annoying interfacing i ever done, panay debugging ng serial port. GSM Controller

    most annoying interfacing i ever done, panay debugging ng serial port.

    ]]>
    bang bang! https://j3ffrw.github.io/p6/ Mon, 18 May 2009 16:07:19 +0000 https://j3ffrw.github.io/p6/ DIY airsoft .6mm BB chronometer Tech specs: PIC16F877a 20Mhz Demo using my Classic Army SLR105 A1 w/ Guarder SP120 spring uses PORTB interrupts for BB detection. DIY airsoft .6mm BB chronometer

    Tech specs:

    PIC16F877a 20Mhz

    Demo using my Classic Army SLR105 A1 w/ Guarder SP120 spring

    uses PORTB interrupts for BB detection.

    ]]>
    beep beep beep! https://j3ffrw.github.io/p1/ Thu, 14 May 2009 23:49:31 +0000 https://j3ffrw.github.io/p1/ Welcome to my blogblogblog. This is what i do when there’s nothing to do. Nikko V2.0. tech specs: PIC16F877a 20Mhz Mission in life: to follow wall. Welcome to my blogblogblog. This is what i do when there’s nothing to do.

    Nikko V2.0. tech specs:

    PIC16F877a 20Mhz

    Mission in life: to follow wall.

    ]]>