recentpopularlog in

kme : newbie   830

« earlier  
Kristin McMurray - YouTube
All the content here is ten years old, but bite-sized enough that it's still useful for people, say, learning to use templates for the first time.
mediawiki  newbie  tutorial  videos 
yesterday by kme
Variables in GNU Make recipes, is that possible? - Super User
This doesn't work because the make tool starts a new shell process for each recipe line. And shell variables – even 'exported' environment variables – cannot possibly propagate "upwards"; they're gone as soon as the shell process exits.

The traditional method is to join the recipe lines using \ in the Makefile:
<code class="language-make">foo: bar baz
line1; \
line2; \
line3</code>
make  makefiles  variables  recipes  explained  newbie 
4 weeks ago by kme
Useful Unix commands for data science
via: http://johnkerl.org/miller/doc/originality.html
Imagine you have a 4.2GB CSV file. It has over 12 million records and 50 columns. All you need from this file is the sum of all values in one particular column.


OK, but I'd mention the useless use of 'cat' to anyone learning from this guide. Alternatives:
<code class="language-bash">
<data.csv awk -F "|" '{ sum += $4 } END { printf "%.2f\n", sum }'
awk -F "|" '{ sum += $4 } END { printf "%.2f\n", sum }' data.csv
</code>
unix  textprocessing  datascience  commandline  reference  newbie 
7 weeks ago by kme
SQLite Describe Table
<code class="language-sql">pragma table_info('albums');</code>
sqlite  sql  newbie  dba  solution 
9 weeks ago by kme
How to add separator in powershell - Stack Overflow
Basically, use 'export-csv' or 'converto-csv' with a '-delimiter' option.
csv  windows  powershell  shellscripting  textprocessing  newbie  solution 
january 2020 by kme
.net - What does $_ TRULY mean in PowerShell? - Stack Overflow
The $_ is only created in the context of a pipeline, that is the passing of output objects from one command into the "input" of another. For pipeline filters (which are like functions), powershell automatically populates the $_ variable with the current object of the pipeline. Now I say current because it is important to note that when multiple objects are passed down the pipeline, the process scriptblock of your filter is executed once per object.
windows  powershell  shellscripting  iteration  pipes  syntax  newbie  solution 
january 2020 by kme
syntax - What does "%" (percent) do in PowerShell? - Stack Overflow
When used in the context of a cmdlet (such as your example), it's an alias for ForEach-Object:
windows  powershell  shellscripting  syntax  newbie  solution 
january 2020 by kme
The Complete Guide to PowerShell Punctuation - Simple Talk
Backtick is backslash, basically, including for line continuation. Bad choice if you ask me, because it's not visually distinctive enough. It looks like crumbs in your code.
powershell  windows  shellscripting  syntax  grammar  explained  reference  newbie 
january 2020 by kme
10 Ways to Open the Command Prompt in Windows 10 | https://www.howtogeek.com/
Right-clicking on the Start menu now shows 'PowerShell' instead of 'Command Prompt' options, as of the "Creators" update.
windows  sysadmin  powershell  commandprompt  cmd  newbie  howto 
january 2020 by kme
Difference between "Command substitution" and "Process substitution"
It's just a shame the first reply is "I do not know what you mean by 'process substitution'". Like, look it up and learn something, bro.

Also a shame that no one mentions it's Korn- and Bash-specific, although zsh probably has it, too.
unix  bash  korn  shell  shellscripting  processsubstitution  thisvsthat  commandsubstitution  newbie  explained 
december 2019 by kme
Better Bash history | Arabesque | https://sanctum.geek.nz/
Nice, concise explanation of how to get sane Bash history settings.
linux  unix  bash  bashhistory  history  dotfiles  newbie  howto  reference 
december 2019 by kme
awk · Serious Shell Programming
Localized function variables declared in the argument scope should be preceded by eight (8) spaces to separate them from the intended function arguments. If the arguments and locals together would exceed 79 characters, separate arguments and locals with a newline.


This is because (from the man page):
Functions may be defined (at the position of a pattern-action statement) thus:

function foo(a, b, c) { ...; return x }

Parameters are passed by value if scalar and by reference if array name; functions may be called recursively. Parameters are local to the function; all other variables are global. Thus local variables may be created by providing excess parameters in the function definition.
awk  shellscripting  styleguide  syntax  functions  newbie 
october 2019 by kme
bash - How do create an alias in shell scripts? - Stack Overflow
From the bash man page:
Aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set using shopt (see the description of shopt under SHELL BUILTIN COMMANDS below).


So this should work:
<code class="language-bash">
#!/bin/bash
shopt -s expand_aliases
alias I_am_only_ls_alias=ls
I_am_only_ls_alias
</code>
Scripts usually use functions, not aliases.
bash  shellscripting  aliases  newbie  solution 
september 2019 by kme
What is the !! (not not) operator in JavaScript? - Stack Overflow
An easy way to describe it is: Boolean(5) === !!5; Same casting, fewer characters
devel  javascript  boolean  idiom  syntax  newbie  dammitbrain 
september 2019 by kme
BashFAQ/024 (Why can't I pipe data to read?) - Greg's Wiki
So when you try to pipe into 'readarray', the variable you're trying to 'readarray' *into* is created in the context of the subshell, and then deleted when the subshell terminates.
The reason for this potentially surprising behaviour, as described above, is that each SubShell introduces a new variable context and environment. The while loop above is executed in a new subshell with its own copy of the variable linecount created with the initial value of '0' taken from the parent shell. This copy then is used for counting. When the while loop is finished, the subshell copy is discarded, and the original variable linecount of the parent (whose value hasn't changed) is used in the echo command.
bash  looping  whileloop  forloop  arrays  mapfile  readarray  syntax  newbie  pitfall  dammitbrain 
august 2019 by kme
passwords - MySQL Utilities - ~/.my.cnf option file - Stack Overflow
The gist is that the other utilities ('mysqldump', for example) use different "defaults groups."
mysql  commandline  cli  sysadmin  dba  newbie  question  answered  solution 
august 2019 by kme
compgen: An Awesome Command To List All Linux Commands - nixCraft
<code class="language-bash">########################################
# Task: show all the bash built-ins
########################################
compgen -b
########################################
# Task: show all the bash keywords
########################################
compgen -k
########################################
# Task: show all the bash functions
########################################
compgen -A function</code>
bash  programmablecompletion  completion  tabcompletion  compgen  reference  newbie 
august 2019 by kme
Where do I find Python? - Apple Community
Asking questions is hard. Coming up with sympathetic answers in the face of profound misunderstandings is even harder.
python  apple  newbie  questions 
august 2019 by kme
perlfaq6 - Regular Expressions - metacpan.org | https://metacpan.org/
In fact, the question that I had is sort-of-answered in perlfaq4, which refers you to Regexp::Common, which is, unfortunately, not part of the standard library.
This section is surprisingly small because the rest of the FAQ is littered with answers involving regular expressions. For example, decoding a URL and checking whether something is a number can be handled with regular expressions, but those answers are found elsewhere in this document (in perlfaq9: "How do I decode or create those %-encodings on the web" and perlfaq4: "How do I determine whether a scalar is a number/whole/integer/float", to be precise).
perl  regex  regexp  faq  newbie  reference 
july 2019 by kme
« earlier      
per page:    204080120160

Copy this bookmark:





to read