deepcube

u/deepcube


r/numbertheory•

I was introduced to the Parker Square concept yesterday when I stumbled upon his latest video on the subject: https://www.youtube.com/watch?v=stpiBy6gWOA

As explained in the video he wants a magic square of square numbers. So far there have been a couple examples that work on all rows and columns and one diagonal, but the second diagonal doesn't add to the same number. He shows two examples, says one is "better" as it uses smaller numbers. I was intrigued so I wrote some code and I think I found one that uses even smaller numbers, but I'm having a hard time believing that no one else has found this one yet as it only took an hour or two of work

13

r/linux•

I enjoy writing things in bash should really use a different language. After being introduced to wordle I decided to write my own clone. I use tput for colors and some cursor movement to keep things pretty. It uses the same answer and wordlist giving the same puzzles on the same day. It prints the shareable unicode boxes at the end. Why play in the browser when you can play in your terminal?

Requirements:

  • bash >= 4 for declare -A (associative arrays) and mapfile (sorry MacOS)
  • xz and base64 for decoding word lists
  • 256 color terminal
  • tput support for setaf, setab, sgr0, cuu, and el commands
  • date support for -d <date> and +%s format

Link: http

542

r/bash•

I enjoy writing things in bash should really use a different language. After being introduced to wordle I decided to write my own clone. I use tput for colors and some cursor movement to keep things pretty. It uses the same answer and wordlist giving the same puzzles on the same day. It prints the shareable unicode boxes at the end. Why play in the browser when you can play in your terminal?

Requirements:

  • bash >= 4 for declare -A (associative arrays) and mapfile (sorry MacOS)
  • xz and base64 for decoding word lists
  • 256 color terminal
  • tput support for setaf, setab, sgr0, cuu, and el commands
  • date support for -d <date> and +%s format

Link: http

2919

r/golang•

go doc has a section for BUG comments. godoc has a -notes flag that allows you to set a regex for which ones to view (e.g. godoc -notes 'BUG|TODO'). I haven't found any way to use the -notes feature with go doc. Is it possible? Do I need to patch go doc?

20

r/Cprog•

I recently began thinking about how complex modern shells are. I wondered, how simple can a shell be? How much functionality can be removed from a shell and run as external tools instead? Yes this would be slower, but it's a shell. If you're worried about performance you should probably be using another language. As an experiment I started to write some of those tools. This post discusses process substitution as an external tool.

Many modern shells incorparate the idea of process substitution, also called non-linear pipelines. The idea showed up in ksh88 and rc shortly thereafter. I'll be using the korn/bash syntax in examples as it seems to be the most common. Let's start with a simple, if

41

r/Cprog•

I did a Huffman project back in school long ago. I wanted to try again so I opened Wikipedia and got hacking. I despise finding dead links in posts so I've included the entirety of the code below. Including comments and empty lines it's 391 lines. cloc reports it as 308 lines of actual code. It's also available for now at this paste bin if you want to curl it: http://ix.io/1Ph6

Please leave comments and questions. If you want to know what something means or why I did something a certain way ask, let's get some activity in this sub.

/*
 * naive huffman encoding
 * symbol length fixed at 8 bits
 * no maximum code length
 */

#include <errno.h>
#include
132

r/Cprog•

Creating a linked list of nodes with automatic storage duration (colloquially "on the stack")

First a quick note on "stack" vs "automatic storage duration." The C standard doesn't mention "stack" or "heap." Those are implementation details. What people often call "on the stack" is "automatic storage duration." There are currently four storage durations (used to be three before C11 added threads). Static, automatic, allocated, and thread local. Static objects are file scope or block scope declared static (and string constants) and exist for the lifetime of the program. Automatic objects are block scope and exist until the end of the block (colloquially "on the stack"). Allocated object

95

r/embedded•

I'm looking for an ARM board that doesn't force me into using their IDE but is still relatively easy to get started writing code to run on bare metal. I want to continue developing on Linux like I normally do, preferably using gcc, but as long as I can throw together my own makefile to compile/assemble/link (and maybe flash) I'm happy. Any suggestions? The shear number of choices boggles the mind, I don't know where to look.

Cheap, low power, and simple are better, but not necessary. No minimum amount of RAM or clock speed. Don't care about word size. Need some gpio pins, rs232 is helpful. My project is building an RPN calculator for now. I have all the parts I need left over from previou

1224


r/climbing•

I have 200 feet of static line and a bunch of 'biners to make anchors (no gear). Any good routes/crags/areas in Joshua Tree for setting up top rope using natural protection (trees or boulders within about 100 feet of the top)?

312

r/bikewrench•

Recently my bike was skipping up and down gears when I was in the smaller cogs. I played with the quick adjust on the shifter and got it a little better, but upon cleaning and relubing my chain I realized there is one joint in the chain that is stiff. It doesn't rotate easily like the others and maintains a slight bend all the way around. Example: if I rotate it then it stays instead of going back to flat under tension http://imgur.com/M8FxNHm . I don't know if it's because I didn't take good care of my chain or because I shifted under power, but it causes a hiccup when I'm peddling in certain gears.

What should I do? Can I fix it? Replace that one link? Take out that link? Buy a new chain?

24