Software Developer Mega Thread

Does anyone know how Discourse does the auto code styling? Is there a library or api or something?

Probably part of the markdown library they use.

I don’t know which they use, but this is what I’ve used in the past:

This one also looks neato:

1 Like

ascii is only 7 bits, you figured out what?

AWK (not to be confused with gawk) is so simple the man page is enough to cover the whole language (not great if looking for examples though)

2 Likes

So… I was thinking:

Nodejs has bad cpu performance in heavy tasks right?

Some services in a website need some cpu-bound tasks right? Like encrypting/hashing passwords (?)

Can I slap some c/c++ or even golang scripts into my npm config (forgot the name… might be package-lock or something)? And take the outputs into my node application?

I’m too lazy to dwelve into java or .net and love node too much ;/

packing like this - just shifting over
01100100 01100101 01100110 01100111 01101111 01100100 01100101 01101100
11001001 10010111 00110110 01111101 11111001 00110010 11101100

instead of like this - using the leftmost bit of first seven bytes for the eighth
01100100 01100101 01100110 01100111 01101111 01100100 01100101 01101100
11100100 11100101 01100110 11100111 11101111 01100100 01100101
i.e.
1100100 1100101 1100110 1100111 1101111 1100100 1100101
1 1 0 1 1 0 0

@oO.o Be aware he’s referring to man 1p awk on Linux systems:

So I’ll use this for shameless plugs. I’m new to the forums but have been watching level1techs youtube for a couple of years.

I started programming by writing hacks for the game Jedi Knight in 1998. Stupid, incredibly simple stuff like changing the rocket laucher’s fire rate from 1 rocket a second to 1000 rockets a second and promptly crashing the game. My love of programming grew from there.

I graduated from university in 2007, worked as a PHP developer from then to 2016 and since then have been teaching web development at a university.

Here’s a few shameless plugs:

  1. My site: https://r.je

  2. The book I wrote: https://www.sitepoint.com/premium/books/php-mysql-novice-to-ninja-6th-edition

  3. My favourite open source project I’ve created: https://github.com/Level-2/Transphporm

3 Likes

Found use for my RockPRO64 now that I don’t have a K8s cluster to worry about. A local git server :smiley:

Just as a temp backup for my super private and personal projects in case GitLab or GitHub is ever out of service.

It’s pretty easy. Make sure git is installed. Create a project directory (I just created it under /git). Run git init --bare on the server. In your local repo either clone it or add the remote origin as domain|IP:/git/yourdir.git.

So on the remote server I performed mkdir -p /git/newsite.git, cd /git/newsite.git, and then git init --bare

Locally I performed git remote add origin git.admindev.labs:/git/newsite.git

Ran the regular commands on the repo (git add, git commit, etc.). Then ran git push origin master. I created an ssh key-pair so i don’t have to authenticate every time.


Unrelated, this is very useful for Angular in Vim.

3 Likes

Compiling vim from source with python3 interp/support is still required for YouCompleteMe. Makes sense, considering Debian’s release cycle.

That being said, vim has officially replaced my reliance on other editors. I was really spotty with ycm depending on environment because I sucked at Linux symlinks/paths/runtime but I guess I’ve leveled up since then :thinking:

I can use ycm for C/C++, JavaScript, Golang, Bash, and Python. Pretty much my primary stack right now.

If y’all are on vim but occasionally roll over to VS Code/IntelliJ/PyCharm/Atom to “autocomplete” then I strongly recommend checking out YouCompleteMe.

If your vim has Python3 interpretation support then you can just clone/install via something like Vundle and run the installer. You need a config file which was really tricky to get going. I spoke with some devs more proficient in ycm than myself and read some wikis/existing configurations.

This is mine:

.ycm_extra_conf.py
import os.path as p
import subprocess

DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )


def GetStandardLibraryIndexInSysPath( sys_path ):
  for index, path in enumerate( sys_path ):
    if p.isfile( p.join( path, 'os.py' ) ):
      return index
  raise RuntimeError( 'Could not find standard library path in Python path.' )


def PythonSysPath( **kwargs ):
  sys_path = kwargs[ 'sys_path' ]

  dependencies = [ p.join( DIR_OF_THIS_SCRIPT, 'python' ),
                   p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
                   p.join( DIR_OF_THIRD_PARTY, 'ycmd' ),
                   p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ),
                   p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ),
                   p.join( DIR_OF_THIRD_PARTY,
                           'requests_deps',
                           'urllib3',
                           'src' ),
                   p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ),
                   p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ) ]

  # The concurrent.futures module is part of the standard library on Python 3.
  interpreter_path = kwargs[ 'interpreter_path' ]
  major_version = int( subprocess.check_output( [
    interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
  ).rstrip().decode( 'utf8' ) )
  if major_version == 2:
    dependencies.append( p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) )

  sys_path[ 0:0 ] = dependencies
  sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
                   p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) )

  return sys_path


from distutils.sysconfig import get_python_inc
import os
import platform
import os.path as p
import subprocess

DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]

database = None

# These are the compilation flags that will be used in case there's no
# compilation database set (by default, one is not set).
# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags;
# only the YCM source code needs it.
'-DUSE_CLANG_COMPLETER',
'-DYCM_EXPORT=',
# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to
# use when compiling headers. So it will guess. Badly. So C++ headers will be
# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag.
# For a C project, you would set this to 'c' instead of 'c++'.
'-x',
'c++',
'-isystem', '/usr/include/c++/9',
'-isystem', '/usr/include/c++/9/backward',
'-isystem', '/usr/include/c++/9/x86_64-solus-linux',
get_python_inc(),
]

# Clang automatically sets the '-std=' flag to 'c++14' for MSVC 2015 or later,
# which is required for compiling the standard library, and to 'c++11' for older
# versions.
#if platform.system() != 'Windows':
#  flags.append( '-std=c++17' )
compilation_database_folder=''

def IsHeaderFile( filename ):
  extension = p.splitext( filename )[ 1 ]
  return extension in [ '.h', '.hxx', '.hpp', '.hh' ]


def FindCorrespondingSourceFile( filename ):
  if IsHeaderFile( filename ):
    basename = p.splitext( filename )[ 0 ]
    for extension in SOURCE_EXTENSIONS:
      replacement_file = basename + extension
      if p.exists( replacement_file ):
        return replacement_file
  return filename


def PathToPythonUsedDuringBuild():
  try:
    filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' )
    with open( filepath ) as f:
      return f.read().strip()
  except OSError:
    return None


def Settings( **kwargs ):
  # Do NOT import ycm_core at module scope.
  import ycm_core

  global database
  if database is None and p.exists( compilation_database_folder ):
    database = ycm_core.CompilationDatabase( compilation_database_folder )

  language = kwargs[ 'language' ]

  if language == 'cfamily':
    # If the file is a header, try to find the corresponding source file and
    # retrieve its flags from the compilation database if using one. This is
    # necessary since compilation databases don't have entries for header files.
    # In addition, use this source file as the translation unit. This makes it
    # possible to jump from a declaration in the header file to its definition
    # in the corresponding source file.
    filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] )

    if not database:
      return {
        'flags': flags,
        'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT,
        'override_filename': filename
      }

    compilation_info = database.GetCompilationInfoForFile( filename )
    if not compilation_info.compiler_flags_:
      return {}

    # Bear in mind that compilation_info.compiler_flags_ does NOT return a
    # python list, but a "list-like" StringVec object.
    final_flags = list( compilation_info.compiler_flags_ )
Here is my ~/.vimrc file
set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/NERDTree'
Plugin 'fatih/vim-go'
Plugin 'valloric/youcompleteme'
"Plugin 'arcticicestudio/nord-vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'

" All of your Plugins must be added before the following line
call vundle#end()            " required

filetype plugin indent on
set expandtab
set shiftwidth=4
set tabstop=4

set number
syntax enable

let g:ycm_global_ycm_extra_conf = '$HOME/.vim/.ycm_extra_conf.py'

let g:airline_theme='deus'

I read the Vundle, YouCompleteMe, and VimAwesome docs pretty heavily before I got this going. It “wOrKs On My MaChINe” but let me know if you have issues because I’ve had plenty lol.

Anyway, figured I’d share this stuff since I’ve become insanely productive on Unix-like systems with my vim and dotfiles.

The last reply to this topic was 86 days ago

STFU this is important.

6 Likes

last reply

Let’s fix that.

3 Likes

I have been lazy and using nano at work. I need to work on my vim-fu again. Time to install vim-tutor to un-forget everything I know.

2 Likes

As software developers, what do we think about “software developer” youtubers popping up and making content like “this is how much I earned at Google” or “you should know these questions for your interview at Facebook” etc.? Basically, no real depth to their content.

2 Likes

Yeah. I find it inspiring yet depressing at the same time.

On the one hand, I could totally get a job at one of those places easily. On the other hand, I could get a job at one of those places and sell my self short.

I have already worked the long hours for a salaried job and made many sacrifices that my older self is just not willing to do anymore. Especially with there being no loyalty between the company and employees. It is just a rat race to get the most out of who ever is willing to drive the market up for “mind share” and “muh profits”.

Yet as someone who is trying to side hustle to eventually work for myself, I am struggling because, “You are not <insert giant overlord company here>! Why would I trust you”. “You cost too much. I can get <insert service here> for free!” “Why can’t you do <service> for free. I will shout you out to everyone if you do a good job.”

Honestly, the cloud has been the worst thing for me and getting security focused products off the ground. The cloud makes everything too easy at the expense of “…we wont purposefully lose your data. wink” and the people are okay with that.

/rant

I have been going through a minor existential crisis lately. I am not in a happy place in my career at the moment.

**Edits due to Discourse needing escape characters for < and >

4 Likes

Honestly, people can “generate content” any way they see fit. A lot of people find it entertaining, those videos. I think it appeals to simple minds and people looking to git rich quick. The computer science and software development fields are already oversaturated. I think this is largely in part to people chasing a dollar because “tech is booming” right now.

I’m not one of those people that think you have to work in a field or job you’re passionate about, far from it. However, I do think that these clickbait titles attract people that are flocking towards an industry that have no idea what they’re getting into. I’m going to pick on JavaScript a bit, but everyone is a JavaScript developer because JavaScript has a lot of controls in place that prevent you from screwing up where something like C, C++, or even Java would give you the middle finger for trying to do.

It inevitably attracts low skilled, junior level software developers. And there’s nothing wrong with that. I myself am still considered “entry level” on the software engineering/development side. But the people chasing the dollar/fame/notoriety have no idea what it takes to continue progressing in the field or staying in the field. So an opportunity for someone passionate and willing to learn is taken by someone for 18 months that is looking to make bank and “play on the computer all day”.

Being a professional athlete is similar, I think. People get a taste for success in high school or whatever and then get rekt in college or semi-pro. However, sports ball teams and the olympics are very stingy and particular about who they recruit and hire, where as tech companies are gobbling up low bar/mediocre talent like there is a shortage of people.

People are further capitalizing on this by not only boasting about their income, but then claiming some moral high ground about abandoning their job to pursue freelancing or a start up. As if the end goal for that isn’t making billions of dollars. Maybe I’m wrong, and jaded, and they really quit their “six figure job” to “be a freelancer” because they only work 20 hours a week and make $60k. I don’t know, I’ve not watched the videos or followed their stories and success. I just think it’s appealing to the lowest common denominator, which is exactly what the job they quit did and what these “full stack web dev React Vue JavaScript Rust SQL Server RabbbbbbitMQQQQ” job board recruiters are doing.

Tl;Dr I fucking hate it. Lately I’ve seen a lot of “I QUIT MY SIX FIGURE JOB TO FREELANCE/START MY OWN BUSINESS”

Fucking cringe and click bait as hell.

5 Likes

Anybody with freelancing experience on websites like freelancer/upwork/fiverr? I work remotely and sometimes i have downtime between tasks but these websites seem a bit frustating, as in clients expecting a full system for 10 bucks.

Do you really have to grind shitty projects for months until you get some rep/good projects? Are there any alternatives?

2 Likes

I had the same experience a few months ago with sysadmin work.

“do an external security audit, I’ll pay you $500”

click

2 Likes

Honestly, it’s laughable to me. I watched one in particular and mid way through the video he let it slip, that he was at Google for under 3 months.

Another youtuber was there under a year and the title was “How I made six figures at Google” but didn’t. There are some others with similar stories about interview questions and what to do to prepare, but honestly

"if you are being recruited by those silicon valley giants, just be yourself."

Because that’s who they want and clearly have a role in mind for you to fill.

There are no scripted interviews, and questions they always ask. That would be a bad sign of talent recruitment in my opinion. People always ask me how I prepare for my interviews, and honestly i am just me. I’m confident in what I know and I express that without “uhms, ahhs…” when I talk. Ask me about what you want me to do and how I would solve problems.

Here’s an example I was asked by a firm in the financial industry:

We have a data lake with petabytes of unstructured data, our ETL process dumps to 3 smaller data stores for reporting in other departments, If we give you an .rdl can you delete 2 columns and then filter the rest of the report?

Me: So you want me to use SSRS to write and modify Cascading reports…

FIZZ BUZZ !!! Don’t ask me to write a cartesian product or a fibanacci generator. That’s not a sign of skill, that’s a sign of “let me stump your confidence”.

3 Likes

Things you can’t do right in C, part UINT64_MAX:

devel ➜  ~ cat double.c
#include <stdio.h>
#include <stdint.h>

int
main()
{
        uint64_t u = UINT64_MAX;
        double d = UINT64_MAX;
        uint64_t doh = (d <= u) ? d : u;
        printf("u: %lu\nd: %.999999999g\ndoh: %lu\n", u, d, doh);
        return 0;
}
devel ➜  ~ ./double
u: 18446744073709551615
d: 18446744073709551616
doh: 140737488349888
6 Likes

I love you

2 Likes