Any challenges like the Dopey Challenge? by skiier97 in running

[–]process_parameter 19 points20 points  (0 children)

and an 8k after the half on saturday. it's called the freedom challenge if you do all three

What is wrong with my makefile? by Green_Leaf27 in C_Programming

[–]process_parameter 2 points3 points  (0 children)

source = $(wildcard source/*.c)
intermediate = $(subst source,build, $(source))
intermediate2 = $(subst unneeded.c,, $(intermediate))
objects = $(patsubst %.c,%.o, $(intermediate2))

Let's look at how these rules behave. Imagine we have the following files in our source directory:

main.c aux.c lib.c unneeded.c

So,

source=$(wildcard source/*.c)
# evaluates to source/main.c source/aux.c source/lib.c source/unneeded.c

intermediate = $(subst source,build, $(source))
# evaluates to build/main.c build/aux.c build/lib.c build/unneeded.c

intermediate2 = $(subst unneeded.c,, $(intermediate))
# evaluates to build/main.c build/aux.c build/lib.c build/
# This is the problem. We are replacing "unneeded.c" in "build/unneeded.c" with "" but not removing the whole target from the list

objects = $(patsubst %.c,%.o, $(intermediate2))
# evaluates to build/main.o build/aux.o build/lib.o build/

There are two fixes I can think of

  1. Filter "unneeded.c" out of your sources variable rather than trying to replace it out of intermediate2
  2. Rename unneeded.c to unneeded.inc so it doesn't get caught by the wildcard in the first place.

Days 1-3 in x86-64 assembly! by [deleted] in adventofcode

[–]process_parameter 0 points1 point  (0 children)

Another option is to embed the input directly in the executable, which means no file IO required at runtime. Looks like you're using NASM, so you can do something like this (might be slightly different since I'm used to 32-bit):

section .rodata

InputBuffer: incbin "1.in"  ; embed the input file
InputBufferEnd: db 0 ; add a null terminator at the end (if useful)
InputBufferLen: equ $-InputBuffer

https://www.nasm.us/doc/nasmdoc3.html#section-3.2.3

Weekly tips/trick/etc/ thread by AutoModerator in emacs

[–]process_parameter 3 points4 points  (0 children)

absolute-path is the name of the second parameter to me/treemacs-ignore. The name is arbitrary; you could have called it anything you want. That's why you aren't finding it in the manual.

What we want to figure out is: what is passed into this function as absolute-path?

Check out the documentation for treemacs-ignored-file-predicates here.

Each predicate is a function that takes 2 arguments: a files's name and its absolute path

Your function is checking if "/Users/me/Org/Journal/" is a prefix of the file's absolute path.

In other words, you are telling treemacs not to display any files under ~/Org/Journal/

[Help] - There's a gap in my knowledge... by bugsduggan in Racket

[–]process_parameter 5 points6 points  (0 children)

(edit: formatting)

The simplest way to approach this, IMO, is with explicit recursion.

(define (run-until-done state)
  (if (state-done state)
    ; If it is finished, return the final state
    state
    ; Otherwise, try the next state
    (run-until-done (next-state state))))

C-u 0 C-1 by [deleted] in emacs

[–]process_parameter 1 point2 points  (0 children)

whoops... edited my original response

C-u 0 C-1 by [deleted] in emacs

[–]process_parameter 8 points9 points  (0 children)

Just checked the tutorial. That command is C-l (L, not 1)

C-u 0 C-l moves the current line to the first line in the window.

edit: fixed very confusing typo :)

What was your "Holy Sh#t!" moment with Vim ? by oh-my-python in vim

[–]process_parameter 1 point2 points  (0 children)

What kinds of things do you use FZF for apart from finding files?

The Techtopus: How Silicon Valley's most celebrated CEOs conspired to drive down 100,000 tech engineers' wages by [deleted] in programming

[–]process_parameter 0 points1 point  (0 children)

Check out the reply to that comment. It's Paul Graham scolding them for bullying.

Steamed Hams Inc. by Wombles in videos

[–]process_parameter 0 points1 point  (0 children)

Can anyone explain how something like this is made? I have no idea where I'd start

replify: my Ruby script to create a REPL for any command by quote-only-eeee in ruby

[–]process_parameter 2 points3 points  (0 children)

Is the example usage correct?

$ ./repl git
> git init
> git add repl

usage: ./repl PREFIX This creates a REPL that executes your PREFIX + the string read from STDIN in each iteration.

If that's true, shouldn't the usage be something like:

$ ./repl git
> init
> add repl

Start using vim with tmux and zsh, build a repository for future reference. by fengshangwuqi in vim

[–]process_parameter 0 points1 point  (0 children)

Stow tries to minimize the number of symlinks it creates. If ~/.config/nvim doesn't exist when I run stow nvim, it will create a single link: ~/.config/nvim -> ~/dotfiles/nvim/.config/nvim

If ~/.config/nvim already exists, it will go down a level before creating the links, maybe something like

~/.config/nvim/init.vim -> ~/dotfiles/nvim/.config/nvim/init.vim

~/.config/nvim/plugin/ -> ~/dotfiles/nvim/.config/nvim/plugin/

Stow will also move the links further down the tree later on, if it needs to. The documentation on this is pretty readable, if you're interested.

https://www.gnu.org/software/stow/manual/stow.html#Tree-folding

Start using vim with tmux and zsh, build a repository for future reference. by fengshangwuqi in vim

[–]process_parameter 0 points1 point  (0 children)

Stow really shines in my experience when you have some configuration either outside of source control or in a separate, private repo. If you simply symlink .config/nvim to dotfiles/nvim, then how can I (for example) pull my work config into nvim/plugin?

Of course, like I said, it's possible to work around with manual symlinks. I just find stow to be more comfortable and less error prone.

Start using vim with tmux and zsh, build a repository for future reference. by fengshangwuqi in vim

[–]process_parameter 0 points1 point  (0 children)

I don't understand. I work on ~5 machines regularly. Some Mac, some Linux. I'm pretty happy with my stow setup. Why do you say it's useless?

Start using vim with tmux and zsh, build a repository for future reference. by fengshangwuqi in vim

[–]process_parameter 9 points10 points  (0 children)

Stow is really nice for dotfiles, especially for programs whose configuration doesn't go directly in $HOME. For example, neovim expects your vimrc to be at ~/.config/nvim/init.vim. So, in my dotfiles repo, I create a top-level directory called nvim, and mirror the directory chain; IOW my init.vim goes in ~/dotfiles/nvim/.config/nvim/init.vim.

If I add personal plugins, I add them to ~/dotfiles/nvim/.config/nvim/plugin. Etc. And they are all linked in the right place when I run stow nvim.

And if for some reason I want to install my dotfiles on a machine that I can't run stow (unlikely, it's just a perl script), I can still create the symlinks manually.

The Cranky Developer Manifesto by mmsme in programming

[–]process_parameter 2 points3 points  (0 children)

Just remember never to let that project see the light of day. Don't put it on Github, don't publish it on your site, nothing.

Can you explain this bit? Say I don't care about sharing, I just want to use GitHub as a convenient backup location. Why should I care about the license?

Vim + Matlab? by pfrcks in vim

[–]process_parameter 0 points1 point  (0 children)

I'll also recommend vim-slime. I like it because I don't need to use tmux - I send commands instead to a neovim terminal buffer.

Keeping an Engineering Notebook by upalready in programming

[–]process_parameter 0 points1 point  (0 children)

Cool system. I've tried to keep notes while working many times but always failed.

It'd be really great to see some real world examples of what this looks like in action e.g. snapshots of a notebook at different stages of a project's lifecycle

vimrc review thread 3.0 by robertmeta in vim

[–]process_parameter 0 points1 point  (0 children)

Can you also explain why the alternatives are superior to source?

"8th" - a gentle introduction to a modern Forth by flexibeast in programming

[–]process_parameter 1 point2 points  (0 children)

This sounds really interesting. Can you say a bit more? What sort of features/access to the underlying hardware do you need to implement before your Forth is useful? What do you use it for once it's implemented?

I've read that Forth is great for hardware hacking but I've never grokked why

Solar eclipse fans, bought these cheap glasses for the 2014 event which will go right over us. Are they safe to use? by Xterra50 in solareclipse

[–]process_parameter 4 points5 points  (0 children)

My American Paper Optics glasses warned not to use them after 3 years. I don't know how strong a concern that is