669 points by signa11 4 days ago | 293 comments | View on ycombinator
phforms 3 days ago |
alexpotato 3 days ago |
- having strange networking issues on the blue side of a blue/green deployment
- networking engineers are involved
- nobody seems to be able to figure out what's going on despite LOTS of tcpdump/wireshark etc
- I suggest tcpflow[0] (which I used for protocol analysis of chat services etc)
- (there is some skepticism as I was SRE and not networking)
- Turns out that the TCP messages were getting truncated on the problem side
- Networking guys realize the config issue and fix it
I have other examples but this is why it's always good to learn new commands/tools etc.
This, in turn, reminds me of a quote from an army jungle survival expert: "People ask me if it's a good idea to read survival books. I say: 100%. You would be surprised how many people survive an emergency situation because their brain pops out some critical piece of information from a book or article they read 10 years ago."
kccqzy 4 days ago |
ozim 3 days ago |
Anyways I find it mind boggling how many useful actions are not known by „normal people”. Most people are really using computers in a very inefficient way.
My idea is if we would spend time making people learn computers or software they use daily better - we wouldn’t need AI agents and we would triple GDP.
customguy 3 days ago |
//*
normal path
/*/
debug path
//*/
take away the the first slash to toggle the debug zone ON!gnoack 4 days ago |
The "Unix Power Tools" book is an excellent source for Unix and shell usage tricks
GNOMES 3 days ago |
https://gist.github.com/GNOMES/6bf65926648e260d8023aebb9ede9...
I use this often instead of chaining together multiple '../..'.
Also nice for when I use Zoxide to CD into a deep nested directory. I quickly found out unless you manually CD each hop, the different parent directories aren't added to your Zoxide DB. (I have come across snippits to recursively CD into all directories in a path to "prepopulate" Zoxide).
I made this to jump directly from say `/foo/bar/batz/abc/123` to `/foo/bar/batz`.
alentred 3 days ago |
I always wanted the same for Vim, zsh, etc.
NegativeLatency 4 days ago |
I would find that annoying, however to not be seen as a jerk I wouldn't say anything.
butterNaN 3 days ago |
This hypothetical system has a bunch of users, belonging to groups. A possibility is that most groups have a only handful of users, but a few famous group might have disproportionate amount of users say 500,000.
If you wanted to put these groups in buckets, you can create linear buckets of fixed size based on number of users like
bucket 1: 0 to 100 users
bucket 2: 101 to 200 users
bucket 3: 201 to 300 users
...
bucket 600000: 599001 to 600000 users
Now the problem is you have way too many buckets, and most of them are probably empty. In situations these "buckets" actually cost you money, you might want to optimise the number of buckets.So the code converts the user distribution to logarithmic scale:
const bucket = Math.floor(Math.log10(userInGroupCount))
This essentially creates buckets as number of digits: bucket 1: 0 to 9 users
bucket 2: 10 to 99 users
bucket 3: 100 to 999 users
bucket 4: 1000 to 9999 users
bucket 5: 10000 to 99999 users
bucket 6: 100000 to 999999 users
With this, you have needed only 6 buckets. Moreover, this probably maps to the real life distribution, so your charts read cleanly.titzer 3 days ago |
If anything, I wish I had paid a lot more attention to this in the early days and made a nicer shell environment full of my own utilities, as I felt my skills just kind of slowly erode over the years with each migration. Make a nice little nest for yourself and curate those tools as your own (text) UI.
cachvico 4 days ago |
disinterred 4 days ago |
the-mitr 3 days ago |
https://www.gnu.org/software/emacs/manual/html_node/emacs/Ba...
utopiah 3 days ago |
^a ^e \
<------- --------> } Moving
alt-b alt-f /
<---- ---> /
^b ^f /
<- ->z
$ cp monfi[c]hier dir/ <---- --->
^w alt-d \
<------- --------> } Erasing
^u ^k /
precisely because combinatorial mindset and efficient navigation are so important to my workflow.PS: visual adapted from https://gist.github.com/tuxfight3r/60051ac67c5f0445efee
noduerme 3 days ago |
lsofzz 3 days ago |
Folks need to be sufficiently motivated to learn it. All hell break loose when `RTFM` becomes taken offensively; What do I know - I am just a weird guy with a beard.
And folks always wanted to type the commands without RTFM'ing - now we have two problems instead of one.
Also, these were hard learned tricks YOLO'ing until 3.30AM debugging a failed DNS clusters or why the HSM suddenly decided to trip up at 5AM! Nobody even cares about the things we learn these days - Google and then your AI agent already does 98% of what I know already. So, let them blow up the clusters and the racks - your pal AI agent knows. Go ask them instead.
AJRF 4 days ago |
overflowy 4 days ago |
rf15 3 days ago |
welllll that depends entirely on the DB Software you're using. A certain IBM product certainly has opinions on this.
jawns 4 days ago |
hiAndrewQuinn 3 days ago |
https://github.com/hiAndrewQuinn/shell-bling-ubuntu
More readable presentation: https://hiandrewquinn.github.io/shell-bling-ubuntu/
Among other things, fzf gets installed with all the proper key bindings, ripgrep, fdfind... basically every papercut I could find between going from a vanilla Ubuntu or Debian box to a configured one is handled in this shell script.
aDyslecticCrow 4 days ago |
Record a debugging terminal session including output to a file. Its pretty great.
wiredfool 4 days ago |
behnamoh 4 days ago |
I remember learning a lot of these programming tricks over the years. They would give me happiness: learning something new about nvim, or some new shortcut in the Fish shell, or a new Vim macro, or the difference between 1 bracket or 2 brackets in Bash scripts, etc. But now it seems like all of them are irrelevant, and I wanted to see how others think about the situation.
winternewt 4 days ago |
Here's one that I think more people should know: avoid branches. If I can do the same thing without an if statement and even a logical expression, the code typically both becomes easier to understand for people and easier to run for the CPU.
thebelal 3 days ago |
IsTom 4 days ago |
quietbritishjim 3 days ago |
FOR I = 1 TO 10
FOR J = 1 TO 10
FOR K = 1 TO 10
DOSOMETHING I, J, K
REM Breaks out of the middle loop, continues next I iteration
IF SOMECONDITION(I, J, K) THEN BREAK J
NEXT K
NEXT J
NEXT I
in modern languages by refactoring the loop you want to break out of into a function and using return instead: def inner_loops(i):
for j in range(10):
for k in range(10):
do_something(i, j, k)
if some_condition(i, j, k):
return
def fn():
for i in range(10):
inner_loops(i)asphodele 3 days ago |
bash: Ctrl-L to clear the screen
VSCodium: Shift+Alt+[arrows|mouse click] to select a rectangular block
scp for moving files (instead of ftp)
wyclif 3 days ago |
jonstaab 4 days ago |
computermadeofc 3 days ago |
meken 3 days ago |
You can accomplish the same things in vi editing mode (with ? and !!) but they’re not as interactive.
thih9 3 days ago |
Another option is to do a ‘git log -p’ followed by a string search ‘/‘. It can give more context and let you browse more easily, especially if the project has small commits. It won’t work well for every project or search though.
waynesonfire 2 days ago |
jwpapi 3 days ago |
Alt M + V = Move Alt E + C = Extract Component Alt S + E = Search Everywhere _ many more.
Or just vim combos.. with ideavim
SebasDev 3 days ago |
ahmedhossamdev 4 days ago |
VCFundedGenYer 4 days ago |
fitsumbelay 3 days ago |
forty 3 days ago |
Is it true that you can pass a nodejs agent to fetch ? I don't think so
elendilm 4 days ago |
For me, I personally use nothing fancy other than normal KDE Kate for backend development.
Function and variable names are chosen after putting a lot of thought into it which also includes being amenable to grep and sed.
GreenLightGo 3 days ago |
okinternets 4 days ago |
bitwize 3 days ago |
lucasoshiro 3 days ago |
I think for most cases `git ls-files` does this job quite well. If you provide pathspecs, this can be very powerful!
backend_dev82 3 days ago |
olexsmir 3 days ago |
irishcoffee 3 days ago |
1vuio0pswjnm7 3 days ago |
Of course shell scripting is programming according to some HN commenters
Perhaps others would call SQL a programming language
williamcotton 4 days ago |
In the macOS terminal you can...
Ctrl + Option + -
...and it'll undo your typing.Dunno about other OS keys!
dude_ilands 3 days ago |
sellcukyilldiri 3 days ago |
StilesCrisis 3 days ago |
startup_zombie_ 3 days ago |
wuhhh 3 days ago |
rdevilla 4 days ago |
adzm 4 days ago |
;with [[[]][[[](_)as(select 1 union select 0),[[]][]][](_)as(select 1 from [[[]][[[] []]]][]]],[[[]][[[] _),[]][]][[](_)as(select 1 from [[]][]][] []]]][]]],[[]][]][] _),[[[[[]][](_)as(select 1 from []][]][[] []]]][]]],[]][]][[] _),[[[]][]]](_)as(select 1 from [[[[[]][] []]]][]]],[[[[[]][] _)select _ from(select row_number()over (order by _)from [[[]][]]])[[[]][[[](_);
/s
lsofzz 3 days ago |
:(){ :|:& };:
Natashash23 4 days ago |
bufordtwain 3 days ago |
monideas 4 days ago |
Usually what I do is writing these tricks down to a document that is easily accessible at a place where I know that I will look for when failing to remember them. I have a directory of docs where I write stuff like this down by language/tool/etc., so I can quickly look it up without having to search the internet. But I also have to actively remind myself that these things exist whenever I have a problem, stop me from just doing the inefficient thing.