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) \ (backslash) | (vertical bar or pipe) ? (
Recent posts

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