Saturday, October 08, 2016

[Kodi] [howto] Enable Chinese Subtitles

Enabling chinese ( or really any non-western character based) subtitles in Kodi should be simple, but requires a few steps that, when not performed perfectly, leads to a frustrating set of garbage characters.


1.) Replace Kodi's default arial.ttf ( or add ) a font that has full unicode support. Most tutorials online use DejaVuSans+DriodSansFallback.ttf. Unfortunately the post I found had a faulty link, but a bit of quick googling showed it was available here:

DejaVu Sans Font Free by DejaVu Fonts | Font Squirrel


2.) Place the .ttf file in Kodi's "Fonts" folder. Depending on your platform this can be in different places. Here are the common ones I've found:

Linux: /usr/share/kodi/media/Fonts/.
OSX: /Users//Library/Application Support/Kodi/kodi/media/Fonts

(For OSX, the Fonts folder wasn't there, so I had to create it).

3.) Choose the font in: Settings>Video>Subtitles>Font for use for Subtitles.

4.) Choose the right character set: Settings>Video>Subtitles>Character Set (for Chinese I used "Chinese Simplified (GBK)". Without this step, you will get garbage output, regardless of the font.

5.) Optional: Add the language you'd like to Download for, if you use the subtitle downloaders, which are quite helpful.

If any options don't appear, make sure you're in the "Expert" mode for the settings.

Troubleshooting:

If you're seeing BOXES for the text, then your font doesn't support the right character set, change your font.

If you're seeing GARBAGE for the test, then you haven't chosen the correct character in the settings. Choose the correct one.

Saturday, June 25, 2016

[howto] [Linux] proxychains + SOCKS5 best practices

Recently was messing around with proxychains in order to allow some commands and programs that don't natively support proxies to be used more securely.

I followed this excellent tutorial:


This worked great, but it requires an SSH tunnel. This is great if you have access to a VPS. But what if you're using some kind of commercial VPN service ( such as PIA ). You need to set up proxychains to use SOCKS5. 

This isn't very difficult. You simply need to add the following line to the [ProxyList] section of your proxychains.conf file:

socks5 IP Port Username Password

I set it up for PIA, so this was my config:

 socks5 109.201.154.239 1080   username ( the one starting with x) password (yes hardcoded, but later on we have a work-around for this glaring security hole).

Unfortunately proxychains seems to not handle DNS names, so I used an IP for PIA's socks proxy ( proxy-nl.privateinternetaccess.com ).

The instructions are available at:

PIA Instructions Page

nslookup proxy-nl.privateinternetaccess.com yielded quite a few IPs:

Name:    proxy-nl.privateinternetaccess.com
Address: 109.201.138.234
Name:    proxy-nl.privateinternetaccess.com
Address: 109.201.154.245
Name:    proxy-nl.privateinternetaccess.com
Address: 109.201.154.165
Name:    proxy-nl.privateinternetaccess.com
Address: 46.166.186.204
Name:    proxy-nl.privateinternetaccess.com
Address: 109.201.138.229

.
.
.
.






You can pick any one to use. Though, I imagine they are used in round-robbin to share the load of the users. So if your proxy stops working all of a sudden, try changing to another IP.

Also the default setting:

# socks4  127.0.0.1 9050

Should be disabled, if you are using strict_chain, since it will error at not being able to contact the DNS through the (non-existant) TOR tunnel.

Test the connection:

proxychains wget www.google.com

Last of all, is the security concern about having to hard-code your password in a .conf file. My workaround has been to use a local, user-only file. Instead of using the above in /etc/proxychains.conf, create the same file in:

~/.proxychains/proxychains.conf

Create the directory if its not already there. Then ensure that only your user may read the file:


chmod go-rwx ~/.proxychains/proxychains.conf

A hash or shadow file would be better, but I haven't quite figured out how to have proxychains use something like that unfortunately.

Hope this is helpful!
 


Wednesday, April 27, 2016

initramfs + cron

If you find that your cron jobs aren't running until you first "edit" the cron job ( even though it was set in the initial initramfs). Check that you have the proper cron.update file, and that both files are owned by root. If one is owned by another user, say the user that you used to create the file, cron will read the config but not run the job. Silently.

Monday, December 14, 2015

Future Story Ideas

Incorporate Demon Hunter introduction.

Maybe play on DK vs DH. Hotplate vs Demon Hunter.

Could be a conflict with Bob? Or, have Bob welcome DH, like he did with Hotplate. Eventual romance between Hotplate and DH? Might be a bit cheesy, but kind of fits, both "forever" changed.

Think on it a bit.

Wednesday, November 25, 2015

[Windows 7] Recover window from "off-screen"

Found this tip from: http://www.virtualdub.org/blog/pivot/entry.php?id=228

Basically:

  • Right-click on the window caption on the taskbar, or select it and use Alt+Space.
    • Alt-Space worked for me, but right click did not.
  • If the Restore option is available, select it to pop the window out of minimized or maximized state.
  • Choose the Move option.
  • Hit an arrow key.
  • Move the mouse.

Tuesday, November 17, 2015

[ServerFarm] Todo list

Home lab todo list:


  1. Set Up home DNS server                      - Done
  2. Check if Valkyrie2. is operational        - Done, unsuccessful
  3. Re-thermal paste Pegasus
  4. Re-Thermal paste Galactica
  5. Get 1-3TB drive for Hiigara                  - Done. 1TB datastore
  6. Activate Windows on Squirrel, virtual-1, and saarkin-cho
  7. Reformat Pegasus, windows side
  8. Upgrade Mini to T7600
  9. Fix pi's Kodi subtittle handling 
    1. Done. But Chinese Characters still not working
    2. Installed OpenSubtittles using SuperRepo
    3. Done, installed Chinese fonts into Raspbian Pi sub-system
    4. Upgrade to Raspbian Jessie. 
  10. Add license to ESXi on Hiigara

Monday, November 09, 2015

[HOWTO] Install Kodi on Raspbian on a RP2

After my HTPC (valkyrie) died from a tiny fall, I've been using a Fire Stick as my Kodi player in the living room. While a nice bit of kit, its not without its disadvantages. Its most definitely a temporary solution.

I'm trying to fix Valkyrie, but that's proving annoying and time consuming. I needed a more permanent solution, in case I don't get it fixed. My first plan was to use a Mac Mini. In fact I recently bought a used Core Duo Mac Mini circa 2007. Unfortunately again, its not due to arrive for another few days, and I'm a very impatient guy.

I then remembered that the Raspberry Pi 2 makes an excellent Kodi player Better yet, its already running 24/7 monitoring my humidor, a task that doesn't even begin to task its 4 cores. So I decided to install Kodi, on Raspbian.

Why not use Openelec or some other Kodi-centric distribution? Simply because I already had the humidor setup running on raspbian and didn't feel like redoing it. 

First to get my up-to-now-headless Raspberry Pi 2 ready, I had to get its HDMI output running correctly.

  • Fix Flashing Menu Bar:

    • Add your used to the video and audio group 
    sudo usermod -aG audio myUser
    sudo usermod -aG video myUser






  • Fix Resolution on HDMI

      • Find the correct resolution:
        • tvservice -d edid 
        • edidparser edid
      • Set bootargs to boot that resolution
        • sudo emacs /boot/config
        •  hdmi_group=1
        • hdmi_mode=16
    • Install Kodi
      • Follow instructions from: http://michael.gorven.za.net



    Tuesday, September 22, 2015

    [RECIPE] Twice Fried Chicken Wings

    Quick Recipe, hopefully have pictures and more detailed directions later:

    20-24 Chicken Wings, separated into drumlets and wing sections.
    4 Tablespoons of general purpose flour
    3 eggs
    1 Teaspoon of Thyme
    1 Teaspoon of Ceyenne Pepper
    1 Teaspoon of Salt
    1 Teaspoon of Pepper
    1 Teaspoon of Soy Sauce
    1 tablespoon of lemon.


    1. Thoroughly thaw the Chicken Wings.  
    2. Heat deep fryer on high. 250-300F at least
    3. Mix the breading
      • Add the flour to a large mixing bowl
      • Add the 3 eggs, scrambled first
      • Add salt, cayenne pepper, black pepper and Thyme
      • Add Lemon and Soy Sauce
      • Mix thoroughly with a spoon/fork
    4. Pour breading over Chicken Wings. 
    5. Mix thoroughly with hands to ensure full coating.
    6. Let stand for 10 minutes, or until oil is ready.
    7. Drop a single wing, and cook thoroughly ( 6-7 minutes). 
      1. Taste and adjust Salt/Pepper/Lemon as needed. 
    8. Drop 4-5 wings into oil at a time. Cook for 2.5-3 minutes. 
      1. Wings should be light brown
    9. Remove from oil and put on strainer to cool. 
    10. Repeat for all Wings. 
    11. Once all wings are done, refry the first set another 1.5-2 minutes. 
      1. Wings should come out darker brown
      2. Allow wings to rest for 5 minutes, that should make the outside very crispy
    12. Repeat for all wings.
    13. Enjoy. 

    Tuesday, September 08, 2015

    Recipe: Cast Iron Skillet Steak

    Defrost.

    Season with Montreal + Cumin

    Preheat oven to 375, with Cast iron skillet inside.

    2 minutes on one side.

    Flip

    2 minutes on other side

    8 minutes in the oven.

    Will update as I tweak the recipe.

    Adjust for size of steak. 3/3/10 with 1+ pound steaks were medium-well.

    Thursday, September 03, 2015

    Export SVN externals into a file called externals.prop

     svn propget svn:externals > externals.prop


    Import SVN externals from a file called externals.prop

    svn propset svn:externals --file ./externals.prop .

    Tuesday, August 25, 2015

    Enable Remote Desktop from command line or SSH

    Found this recently, and its very useful if you have SSH/CMD access to a box, but forgot to enable Remote Desktop.

    C:\>netsh firewall set service remoteadmin enable
    C:\>netsh firewall set service remotedesktop enable

    Tested in Windows 7, but resulted in a deprecated message. Still worked though, so probably ok for now. Windows 10 users might need something else.

    Original post:

    http://superuser.com/questions/181242/enabling-rdp-or-installing-a-vnc-server-on-windows-7-from-the-command-line

    Friday, May 08, 2015

    Monday, April 06, 2015

    HowTo: Fix a 2 drive failure in an MDADM Raid5 array ( continued )

    Happened again to the raid array. Found that my previous instructions weren't 100% correct.

    The command to use is:

    sudo mdadm --examine /dev/sdb1 ( not --detail )

    Here is the stackoverflow post:

    http://superuser.com/questions/603481/how-do-i-reactivate-my-mdadm-raid5-array


    Tuesday, August 05, 2014

    Rosewill RSV-S4-X and mdadm RAID5

    I've had the Rosewill RSV-S4-X for about a week now. I've got it integrated into my MDADM RAID5 array using 5 2TB SATA drives. So far I think its working OK. I'd say 4 out of 5 stars. More on why that is later.

    So the enclosure comes with a Silicon Image 3132 PCIe eSata expansion card. This is what does the port-multiplication. I'm currently running Ubuntu 13.10. The Sil3132 is supposed to be well supported in linux. My experience has been good in general with it. Ubuntu picked it up right away with no issue.

    The enclosure itself seems to take all its queues from the card. Its default is to be in JBOD mode, which is exactly what I need for mdadm. I added 2 more 2TB HDs to the enclosure, and they showed up as /dev/sd[gh] right away. So far so good.

    I had a drive fail inside the machine. I added /dev/sdg1 to the array and had it re-sync. The re-sync process was holding at a steady 70MB/s. While not blazingly fast, this seemed about normal with the speeds I was getting from the on-board SATA ports.

    Cons:

    So far I have only run into 2 problems with the system, and I think they're related. I originally placed the 2 drives in the top most 2 slots. This turned out to be slots 3 and 4. At first I didn't think much of it. Later on, I removed the faulty HD and ran some tests on it through WinDFT. It seemed to pass those tests fine, so I shut the system down and inserted the drive into Slot 1 of the Rosewill. I wasn't 100% sure if the rosewill was hot-swap, so I didn't take the chance.

    Immediately things didn't go well. The Sil3132 was no longer being recognized. I rebooted a few times, with no change. Finally I decided to just remove the faulty drive. A few reboots later the card came back up, as did the two drives. Unfortunately by then mdadm had already removed /dev/sdg1 ( the one in the enclosure) from the array. A --re-add was refused.

    My hypothesis is that by adding the drive into Slot 1, the raid card reordered the drives. This was enough to confuse mdadm, and the drive ended up being removed and the array degraded. I've since did an --add on the drive, and the array re-synced over night. I rebooted the machine a few times to ensure that it works, and things seem to be going ok.

    Conclusion:

    Its  a nice enclosure, and for home use I think its perfectly fine. I would be hesitant to use it in a mission-critical environment, simply because of the unknowns about drive re-ordering.

    I'm especially concerned about what might happen if more of my drives are on the enclosure. If the drives re-order again, and 2 of my drives get kicked out of the RAID, then I may be in trouble. Keep good backups of everything!

    I'll try to keep this post updated as I find more things. \

    Sunday, January 12, 2014

    [Linux] Pogoplug constant blinking orange light

    My pogoplug started blinking orange shortly after I added OptWare to it. Usually the blinking orange signals that its having trouble reading or is currently working on a drive. This is not normal disk read/write.

    I found that it had mounted the /opt directory, which is on the thumbdrive and houses the OptWare files. Unmounting this from the web interface fixes the problem ( but the /opt stays mounted on the file system when you SSH in as root).


    Friday, December 13, 2013

    Messenger comes


    -------

    A few short months ago, a messenger had arrived at the manor. The messenger was from the king of Stormwind himself. The messenger checked the directions he was given twice before knocking on the dilapidated home in the middle of Elwynn Forest. Surely he must be in the wrong area. There was no way a Warlock or a Death Knight would live in a house that looked so much of ... Nature.

    The surprises continued as the door opened. A young Drainei had answered, though in honesty, the messenger wasn't the best judge of age of other races. But judging from her attire and smile, she wasn't an adventurer, and couldn't be the heroes he was sent to find.

    "Yes? Can I help you Soldier?" asked the Drainei in a cheery voice. The Drainei was attractive. Her bright smile, and sunny greeting only helped to momentarily clear the messenger's mind of what he was about to say.

    "I have a message for Master Bob, and Mistress Hotplate" replied the messenger, in the most authoritative tone he could muster.

    The messenger saw a tiger behind her yawn, apparently bored of the entire exchange.

    "I'll take it to them" answered the Drainei, extend her hand to take the missives.

    "I'm sorry ma'am, but I was instructed to present the messages to them in person". said the Messenger.

    "Suit yourself, come in.", the door opened wider to allow the messenger in. "My name is Huntry. Bob's in his study, and I think Hotplate is in the backyard practicing. I'll see if I can get them"

    The messenger walked through the threshold. The house almost seemed bigger on the inside. It seemed ordinary, if not a little messy. There were singe marks on the drapes, some bigger than others. Simple wooden furnishings here and there. Though not ornate, the furniture was solid and strong. This was easy to notice since the large tiger "brushed" against the leg of a table, and the table didn't budge.

    "Have a seat at the table", Huntry gestured towards the chair closes to the Tiger. The Messenger thought for a moment about sitting next to the Tiger, but its large fangs "encouraged" him to take a seat a few chairs down.


    ------------------------

    A raggedy looking old man walked into the room. His beard was unkempt, his eyes sullen from too much reading, the midsection of his simple robe was tighter than on the rest of his body. To the casual observer, he looked like a simple, though somewhat curmudgeon farmer. But the messenger had been around warriors all his life, knew how they talked, knew how they walked, and knew how they entered a room. This "old man" did not walk like an old man. His gait had no limp, and was fluid, never off balance. As he entered the room, his eyes flickered around, quickly taking stock of anything, or any one, that hadn't been there before.

    "You have a message for me... corporal?" asked the old man.

    "Yes sir, from King Varian himself". The messenger drew closer to hand the sealed note to the old man. As he got closer to his subject, it became much clearer that this was no ordinary old man. His eyes were sharp, and burned with a fire born of service and magic.

    The messenger handed the sealed envelope to Bob and waited patiently.

    Bob took the message, and seeing that the messenger had no intention of leaving until it had been read, quickly broke the wax seal and opened the letter. 

    Huntry busied herself by "cleaning" a shelf nearby. Conveniently the position afforded her a clear view of the message. Dranei eyes are sharp. Unfortunately Huntry could only see a blank page. Bob studied the page intently. Obviously he could see something that Huntry could not.

    Bob folded the missive and regarded the messenger. "Yes, two."

    "Yes sir, I shall inform the King of your reply" replied the messenger, giving a quick bow. Huntry showed the messenger out.

    Huntry returned to the table to find Bob re-reading the missive quietly.

    "Yes to what?" asked Huntry, no longer able to contain her curiosity. Bob was never one to accept anything, especially not from a message.

    "Tell Hotplate to pack her gear. Her and I are leaving at nightfall." commanded Bob. Though his voice was clear, Huntry could tell that his attention was elsewhere.

    Suddenly Kragnar and Bizpit materialized between them. Bob, not surprised in the least merely commanded,  "Find Onaara, tell her to drop whatever she's doing and come here". Kragnar disappeared without a reply. Bob turned to Bizpit, the usually annoying Imp was silent. He must have picked up on his master's thoughts and remained serious for once.

    "Send word to the dragons, I'll need their help soon" Bizpit disppeared as quickly as Kragnar. 

    Huntry, frozen by the sudden activity merely stared at Bob. It was clear that Bob was worried. Again, not characteristic of the old Warlock at all.

    "Ready my armor, I must consult my books before we leave. Wait for Onaara, she should arrive within the week. When she arrives, both of you follow us."

    "I don't understand, where are you going? Where am I going? What's going on?" asked Huntry.

    "Anduin is missing, they think the Horde has taken him" replied Bob.

    Prime lens and E3

    Took my 35mm f/1.8 lens to E3. Rationale was that the low light inside the expo floor would really need the super wide aperture. Plus I could simply zoom with my feet

    Unfortunately it just didn't give me the flexibility I needed. I was constantly at the wrong place, and everything was out of composition. It was frustrating.  The wide aperture was nice, but a flash would have probably done more to help with the whole situation.

    [Server Fame] Current State of Machines

    So every now and then I put up an update on my never-ending-collection of computers. Near as I can figure, this is whats up.

    Phuong:
    25Mhz 286/386
    Retired, donated. I just didn't have the room to keep it any longer.

    Mouse:
    200Mhz Pentium Pro w/MMX
    Retired, donated. I just didn't ahve the room to keep it any longer

    Uppy:
    350Mhz Pentium 3 Laptop
    Retired, waiting to be donated. I don't have room for it, but I haven't got around to donating it yet.

    Downy:
    1.4Ghz Athlon T-bird. 768MB RAM, 2.25TB
    Retired. Still in box. It is still viable, and works well. Considered giving it to my parents and having them have a server at home. That might have been the plan if I didn't get a "new" Core2Duo to become the new main desktop.

    Frisket:
    2.3Ghz Athlon64 3000+ 3GB RAM, 8TB
    Currently the main server. Still going strong. Recently had its first hard drive fault. The plan for the future is for it to "retire" and head to my parent's place to serve as their DLNA server, and offsite backup. It won't have a raid when its there, so the load should be quite a bit less. Majority of the space will be on the 2TB external drive.

    Squirrel:
    2.66Ghz Core2Quad E8400 8GB RAM, 128GB SSD, 1TB 7200rpm
    Still the "big iron" of the farm. Running strong. Installing the extra 4GB of ram was harrowing, since it seemed to cause instability in the north or southbridge. Was very annoying to diagnose.

    Currently running the AirVideo software for streaming to the iOS devices. Also runs the uTorrent software for downloading. Also running PS3 Media Server. Its a backup DLNA server. I still haven't found a software I like as much as MediaTomb, but MediaTomb just isn't doing everything I want it to. Plus squirrel is beefy enough to do live-transcoding, which mostly works.

    New:
    Galactica:
    2.40Ghz Core2Duo E7400, 17" Mobile Workstation. 128GB SSD
    One of two laptops I got from a friend. It was missing battery, charger, ram and HD. This laptop even has a Quadro level graphics card. It plays WoW fine, though I don't play that much. It plays hearthstone just fine though. Named after Battlestar Galactica, because its so huge.

    Pegaus:
    2.40Ghz Core2Duo E7400 15" Laptop. 4GB RAM, 750GB 7200RPM
    The other of the two laptops I got from a friend. This one is virtually the same as the previous, but with intel integrated graphics, a 15" screen and a 7200rpm HD instead of the SSD. I use it mostly for when I'm out and about. Though lately I've been using it as a server to offload repacking/transcoding duties from Frisket. With Gigabit and SMB mounts, the network lag isn't that bad. Named after the other battlestar, Pegasus.

    Codename: Dreadnaught:
    2.66Ghz Core2Duo E6700, 4GB of RAM, 300GB 7200RPM
    I got this for cheap at work. It came with a Quadro graphics card, but it is faulty so I took ti out. But it has onboard video, which I'm using now, it works fine. Right now I'm planning on migrating the 8TB RAID from frisket to this machine. This will become my main server. Frisket will then be moved to lighter duties at my parent's place. This solves a few of the issues I was trying to figure out with the Pogoplug and PS3.

    Haven't decided if I'm going to get a case for it. I want to. The alternative is to transplant frisket into the case from work, and put the Core2Duo into Frisket's Antec 300. The case from work is probably good enough for what my parents need, but if its going to be on 24/7 and it gets super hot where they are.




    Saturday, June 01, 2013

    Converting to Mp4 ( for PS3 use for example)

    http://askubuntu.com/questions/50433/how-to-convert-mkv-file-into-mp4-file-losslessly

    I decided to use avidemux. It seems to work pretty well. On this Core2Duo T7700 @2.4Ghz ( laptop) speed was decent. Specially since this IS NOT TRANSCODING then speeds are very fast. The only transcoding I had to do was the Audio into AAC, since the MP4 container only supports AAC with H264 and presumable X264.

    Note: This is a repackaging program, but it will do transcoding as well. Transcoding recompresses a video ( or audio or both) from one format to another. Demuxing ( remuxing) copies video/audio/both from one container to another, without recompressing ( so its fast and lossless). In this case I was converting from mkv and avi's ( the containers) to mp4 (container).

    Wednesday, March 20, 2013

    [Android] Easy Logging

    From the Java ( log to logcat)

    import android.util.Log

    Log.w("myApp", "My Message");

    From the NDK/Native side ( still logs to logcat)

    #include
    #define APPNAME "MyApp"


    __android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "MyMessage\n");

    also remember to add the following to Android.mk

    LD_LDFLAGS := -llog