Skip to main content

Posts

Convert a `String` to Windows/Linux/Mac filename safe `String`

String.prototype.fToFilenameSafeString I preserve a consistent naming convention throughout all the different tech layer making up a solution. For example backend DB object name will have same name as JavaScript object and will have the same CSS wrapping class name. This doesn't always work as certain characters are not allowed in some contexts, one being filenames character restrictions. A quick solution is to pipe the String through encodeURIComponent(...) but that is somewhat aggressive and results in filenames that are not human friendly. The below function encodes only the illegal characters which results in more readable filenames. String.prototype.fToFilenameSafeString = function() { /* unsafe characters list (https://stackoverflow.com/a/31976060/913223) : < (less than) > (greater than) : (colon - sometimes works, but is actually NTFS Alternate Data Streams) " (double quote) / (forward slash) ...

FreeBSD Install Issue `timeout on slot 13 port 3`

ahcich timeout on slot X port X Mac install workaround My attempts to install FreeBSD resulted in failures with `timeout on slot 13 port 3` , there are many search results regarding this but none relevant to the installation procedure. The workaround was to enable Safe Mode mode in the boot options - sharing this simple solution so that it saves frustration and time for the next victim of this issue. If this has helped comment or follow me on twitter @danielsokolows .

`rsync` freezes and hangs on large files

rsync: connection unexpectedly closed (... bytes received so far) [sender] I have regular server backups which transfers large files over 500GB+ and have --append-verify or --checkusm over ssh parameters specified. What I have found upon analysis is that once the client side completes it's file checks then the server side checks start. Which means while the server is doing it's checks the client side will appear hanged and frozen - run htop on the server to rsync working away. On related note, this very LONG wait would trigger SSH timeout and a rsync: connection unexpectedly closed (254 bytes received so far) [sender] error message, solution is to add below settings to your /etc/ssh/sshd_config . # This will make the server send the clients a “null packet” every 120 seconds and not disconnect them until the client # have been inactive for 720 intervals (120 seconds * 720 = 86400 seconds = 24 hours). ClientAliveInterval 120 ClientAliveCountMax 720 Both issues a...

CPU Basd Hashcat Cracking

Setting up Hashcat for CPU Hacking on Debian Hashcat for CPU hacking turned out to be an adventure that almost failed, this is a quick post of the steps needed as a referece if I need to repeat this process again. One could setup run John The Ripper (simpler setup) however I decided to use Hashcat as it's GPU cracking is faster compared to JtR and so down the line I won't have to re-learn. I've have tried the Intel OpenCL 5.0 and 18.1 runtimes but they are not supported on our CPU Pentium(R) Dual-Core CPU E5400 Install Hashcat direclty https://hashcat.net/hashcat/ Install AMD OpenCL CPU package, it has been discounteued but you can get it here. tar xvfj AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2 ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh ./clinfo ./hashcat64.bin -b --force If the above clinfo or hashccat64.bin fail see https://askubuntu.com/q/821341 , and confirm `/etc/ld.so.conf.d/AMDAPPSDK.conf` is proper, and also you might need to set your LD...

Debian/Ubuntu Bitcoin Daemon Startup Script

`bitcoind` init.d startup script The Debian bitcoind package does not install or contain any init.d scripts, and net search failed to return any decent examples so I had to crate my own. If this has helped please comment or follow me on twitter danielsokolows - be great. #!/bin/sh ### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*- ### BEGIN INIT INFO # Provides: bitcoind # Required-Start: $network $remote_fs $local_fs # Required-Stop: $network $remote_fs $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Bitcoin Deamon # Description: Bitcoin Deamon ### END INIT INFO # modified by Daniel Sokolowski # Install by typing update-rc.d defaults PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC=bitcoind NAME=bitcoind PIDFILE=/var/run/bitcoind.pid USER=root DAEMON=/usr/bin/bitcoind #DAEMON_ARGS="-pid=$PIDFILE -datadir=/mnt/M=ST8000AS0002-1NA17Z,S=Z840PWH2/bitcoind-datadir -debuglogfile=/var/log/bitcoind.log" DAEMON_ARGS="-daem...

Disable Website Notifications in Chrome and Opera Browsers

... or I can't do it since the 'Websites' tab is missing! Information on the Internet is now outdated and incorrect, there is no longer Website settings tab that allows you to disable these annoying push notification requests both in Chrome, Opera and other Webkit based browsers. I was finally able to find a workaround however and it is to add a wildcard notification block filter. Posting this for your benefit so if this has helped you please comment or follow me @danielsokolow . Instructions Open Settings Search for notifications Open Content settings Click on Notifciations In the Block section add two filters: https://* , and http://* Confirm blocking has worked by visiting http://www.bennish.net/web-notifications.html

CKEditor Step Out of Element Keyboard Shortcut

Inserting a new paragraph outside of a wrapping element CKEditor provides templating functionality that allows for insertion of HTML snippets. This is very handy, however for complex markup a problem arises where pressing 'Enter' creates a new paragraph but within the wrapping elements. Searching for how to 'step out of the element' returned nothing helpful and that is the reason why I'm posting a solution. Keyboard shortcuts to force a new paragraph outside the wrapping element are: Shift+Ctrl+3 – Enables entering content (by adding a new paragraph) before a problematic element. Shift+Ctrl+4 – Enables entering content (by adding a new paragraph) after a problematic element. On a side note, the above is provided through the built in Magic Line plugin which is supposed to show a red line insert new paragraph widget but that does not always work. If this has helped you, be legendary and do social share this and do follow me on twitter @danielsokol...

Light Straightforward CSS Grid

Skeleton vanilla CSS grid When you have been at it for a while you realize most of the time less is more, and so in that spirit below is a skeleton grid. It was created without any pre-processor in vanilla CSS, and has been field tested on enterprise level projects. Source code here: https://bitbucket.org/snippets/danielsokolowski/d68x/light-column-gird-system If this has helped you, be legendary and do social share this and do follow me on twitter @danielsokolows . /* Light Column Grid v2018-Dev-05 ############################## See: https://bitbucket.org/snippets/danielsokolowski/d68x/light-column-gird-system TODO,Jun-13: possibly rather then negative margins use calc and space-between to avoid issues with horizontal scroll on small devices, see: https://stackoverflow.com/questions/20626685/better-way-to-set-distance-between-flexbox-items Example: ``` <div class="columnWrapper"> <div class="column width-4/12"> ... </div>...

Updated Force.com IDE Fork

My improved Force.com IDE fork I would argue it is rare that re-inventing the wheel is the better choice compared to just improving an existing solution - I'm looking at you Salesforce Extensions for VS Code - and so since Salesforce opened sourced their Force.com IDE I have been updating it to suit my needs, mostly to speedup development: WSDL version 42 Ability to 'Disable 'Save to Server' dirty resource check' Ability to 'Disable 'Save to Server' synchronize check' Ability to 'Disable 'Save to Server' user confirmation check' Update Site and Public Repo Today a co-worker needed to get setup with SF development and so I have officially created a public repo and an update site for my version, just add the the below URL to your 'Help > Install New Software...' to get your copy. https://raw.githubusercontent.com/danielsokolowski/idecore/master/eclipse-ide-update-site/site.xml Pull requests welcomed: http...

Windows 10, 8, 7 Night Mode

A universal night mode for Eclipse, Sublime, Atom, VSCode, Chrome, ... <ANYTHING> I do code for a living, lots of it , and night mode experience has always been subpar. You may set your development IDE to a night theme but everything else would still be regular and hence ultimately would create more eye strain, but I have found the perfect solution: NegativeScreen Thais fantastic utility that you can download here is a blanket solution. It inverts your whole desktop using a smart conversion metric to keep colors still same, i.e. red is still red, images of course look funny but for text (i.e. programming) it is fantastic. I find it soo useful that I have donated , you should too :) My Tweaked Matrix NegativeScreen comes with a companion tool ColorMatrix Viewer that allows you to visually create your own night mode conversion matrix, below is mine which is based on 'Smart Inversion Alt 2b' but the blacks are lightened which I find helps with overall ...

Lucida Console with `0` crossed

Lucida Console, best programing font improved I like this font for programming, compared to other it allows most lines to fit on the screen and overall characters are taller. However it's 0 and O are too similar for my liking. So using FontForge I have fixed that. You can download the .tff file at the BitBucket repository here . Be legendary and do social like this post as that helps me immensely and do follow me on twitter: @danielsokolows .

Minimial Freeswtich Install on Debian 9

Reduced Freeswitch Dependencies List Perhaps I missed something obvious but installing Freeswtich on Debian using instruction from official site here results in the install wanting to pull a ridiculous 1.1 gigs of dependencies. To avoid that I choose to built directly from source and only install whatever was missing whenever the ./configure or make would fail. Below is bare minimum needed to complete the build process based on default modules.conf , install these first then follow Compiling Latest Master (for testing) section from the official Debian 9 Stretch instructions. apt install build-essential apt install libtool-bin apt install zlib1g-dev apt install libjpeg-dev apt install pkg-config apt install libsqlite3-dev apt install libcurl4-openssl-dev apt install libpcre3-dev apt install libspeex-dev apt install libspeexdsp-dev apt install libldns-dev apt install libedit-dev apt install libtiff5-dev apt install yasm apt install libopus-dev apt install libsndfile-dev ...

A letter to City of Kingston regarding "Residential Rental Licensing"

I am a landlord that your proposal would impact and I am truly disappointed, angry, and strongly against the 'Residential Rental Licensing' program proposal. Considering it only targets properties of three units or less I see this as nothing more than a money grab. You failing to include 4 plus unit property owners conveniently excludes large corporations like Homestead. I find this discriminatory and I haphazardly conclude you choose to do so to avoid the lobbying against it you would receive from someone of bigger pockets. Also, given the fact that as of April 30, 2018 we are required to provide a standardized lease, I see the goals of this licensing program made obsolete and redundant. The 14 page long lease document, in particular section 'J - Maintenance and Repairs' outlines and educates the tenant as to the landlord's responsibilities and if these are not met to seek assistance through Landlord and Tenant Board (LTB). Your goal to prevent substan...

MetaTrader is Utter Garbage

Zero confidence in its Strategy Tester I have over a year of experience programing in the MQL4/MQL5 languages, I have worked through many quirks and gotchas and amassed a considerable local code repository - so I am qualified to make such a bold statement. Today I am just throwing in a towel. My lack of confidence in its ability to simulate trades is now absolute ZERO and casts serious doubts onto previous results. I have reported this in the forums and also through a support tickets but that went on nowhere. The picture below is of a custom symbol, left is the data Strategy Tester, right is normal chart history, both of them have a signal attached. You can clearly see the Strategy Tester chart is different and missing bars and so of course the signal activates differently. I've discovered this issue when I tested my multi symbol expert on Symbol A and then on Symbol B and found the sum net profit and orders placed to be different than when I tested the same expert on Sy...

Nantucket World Sailing Map

Fresh Game Sailing Reference Map Playing the enjoyable Nantucket sailing game set in a world of Moby Dick, however it has one flaw: while you are in a port dock you can not see the sailing world map, there is no keyboard shortcut for it as far as I can tell. To me this is an issue, for example when you are trying to reference locations of job quests. To solve this I have crated an image of the world just at the start of a new game which I have loaded on my second monitor. Right click the above image and choose 'Open Image in new tab' or 'Save image as'. Be legendary and do social like this post as that helps me immensely and do follow me on twitter: @danielsokolows .

No remote audio when connecting to Windows 2008 Server

Error: Windows Media Player cannot play the file because there is a problem with your sound device The Internet was not helpful in regards to this; this post did not work for me. But after further digging myself I was able to determine that the issue is due to a 'Allow audio and video playback redirection' default policy being disabled on a server environment, the fix is to enable it. Open start menu and search for 'Edit group policy' and navigate to 'Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Device and Resources' and enable 'Allow audio and video playback redirection'. Be legendary and do social like this post as that helps me immensely and do follow me on twitter: @danielsokolows .

Change Windows 7 Taskbar Text Color

This likely works for Windows 8, and 10. I got fed-up with Windows 10 forced updates at worst possible time (and other stupidities) and finally installed Windows 2008 R2 (Windows 7) so that I am in total control. But Windows 7 lacks the 'Task View' (Win + Tab) which is awesome and can be duplicated with Switcher ', however it requires using Windows Aero theming engine. I personally prefer the classic gray flat look so as a compromise I tweaked the default theme to a light solid color - which makes the white taskbar icon text unreadable, and Microsoft in all it's wisdom to this day does not allow any sane way to change it. After way too much effort spent in finding a solution I want to admit to I did finally stumbled onto the fact that Classic Shell includes change taskbar color functionality! - a simple change to black as in the screenshot and things are good again. Be legendary and do social like this post as that helps me immensely and do follow me on twi...

Brother Scanner Drivers for Windows Server

Modded drivers to allow scanning MFC-J4710DW on a Windows Server 2008 R2 Officially only printing is supported for the Windows Server platform for the MFC-J4710DW and similar printers. On the download page you are advised that the full software suite functionality is not available . If you attempt to install the full software you will receive OS not supported error, trying to force install the drivers also fails. But with an iron will, a weekends worth of time, and some luck I was able to modify later model's drivers and successfully install the scanner drivers. Unfortunately ControlCenter4 seems to be hardcoded not to function in a Server environment, but as an alternative I found NAPS2 which works wonderfully with the 'scan' button events - please donate to the developer! You can find the modified driver at this MFC-J4710DW Scanner Driver Link . Please note 'Desktop Experience' feature is required or driver will fail with Error: No INF AddService dire...

Force recall a Salesforce approval process

Non-submitter and non-administrator approval recall Salesforce lacks the functionality to recall an in-flight approval process for anyone other than the original submitter or a system administrator. For our latest client this posed a problem as their specific business needs required the ability to recall an approval one step back in a multi person process, and giving the approvers administrative permissions posed an unacceptable security risk. Thus until Salesforce implements this idea (please upvote) to extend recalling to record owners, below approach workaround will accomplish approval recall without compromising security - albeit in an interesting way. setup an email service that runs in elevated privileges and recalls force recall an approval provide normal users the ability to execute an Apex method that internally emails that service Reference setup Below are the relevant bits extracted from a working solution, leverage and adapt to your own unique solution. Ape...

First error: Process failed. First exception on row 0; first error: INVALID_OPERATION, Illegal transition type: []

Approving a record through APEX error Searched return no relevant results to the issue I encountered. I encountered this when writing a schedulable class and thought it was due to SF restriction inside the limited context of the scheduler; so posting this in hopes it saves others some frustration and time. The solution Check the spelling when specifying the action (see Docs here ). In my case I had Approved instead of Approve , allowed options are Approve , Remove d , and Reject . ... Approval.ProcessWorkitemRequest oPWR = new Approval.ProcessWorkitemRequest(); oPWR.setComments('Auto approved through JobId: \'' + oBatchableContext.getJobId() + '\''); oPWR.setAction('Approve'); // allowed choices are 'Approve`, `Removed`, `Reject`. oPWR.setWorkItemId(oWorkItemCurrent.ID); Approval.ProcessResult oPR = Approval.process(oPWR); ... If this has helped you feel free to comment or follow me on twitter @danielsokolows .