Reputation
421
Top tag
Next privilege 500 Rep.
Access review queues
Badges
2 14
Impact
~43k people reached

Apr
20
awarded  Popular Question
Feb
27
comment Equivalent of memmove on files: copy a range of bytes to an earlier position
On Linux with some filesystem you could try fallocate
Feb
27
comment How to delete part of a binary file without copying
I've added fallocate-based answer to the related question. If you are using a recent Linux kernel and the supported filesystem; could you try it?
Feb
27
answered Best way to remove bytes from the start of a file?
Feb
19
comment Is there a way to auto turn-on Ubuntu?
@Trengot: yes. You can send Wake-on-LAN messages from iOS device.
Oct
1
comment How to efficiently generate large, uniformly distributed, random integers in bash?
indeed, uL (long) is the minimum that bash must support, gnu bash uses maxint_t type that is equal or larger than long. od should be extended to support maxint_t.
Sep
30
revised How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
remove unnecessary quotes
Sep
30
suggested approved edit on How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
Sep
30
comment How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
I don't see how dc converts a decimal number e.g., 1193046 to 4 bytes as the code in my question and the other two answers does.
Sep
30
revised How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
4 bytes, not 8
Sep
30
comment How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
+1. It produces the correct 4 bytes for 0..2**32-1 range, It uses only builtin printf command, and It is faster (for a single number).
Sep
30
comment How to efficiently generate large, uniformly distributed, random integers in bash?
if you want to support the full bash range then uL (long) might be too small if bash uses maxint_t (or long long if they are different). long long is not a typo.
Sep
30
comment How to efficiently generate large, uniformly distributed, random integers in bash?
there is long long that can be 64bit while int=long=32bit on some platforms. You should not claim 0..2**60 range if you can't guarantee it on all platforms. On the other hand bash might not support this range itself on such platforms (I don't know, perhaps it uses maxint_t and then u8 is more correct if you want to assert the fixed range (od doesn't support specifying maxint if yours range is whatever bash's platform-dependent? range is). If the bash range depends on sizeof long then uL might be more appropriate). Do you want the full range that bash supports on all OSes or a fixed range?
Sep
27
comment How to efficiently generate large, uniformly distributed, random integers in bash?
uL implies sizeof(long)>=8 for the range. It is not guaranteed. You could use u8 to assert that platform has such integer.
Sep
27
comment How to efficiently generate large, uniformly distributed, random integers in bash?
your solution reminds me how random.py is written. random.Random class uses 53bit? generator to return arbitrary large random numbers (multiple invocations), random.SystemRandom does the same using os.urandom() that can be implemented using /dev/urandom.
Sep
27
comment How to efficiently generate large, uniformly distributed, random integers in bash?
your solution assumes that sizeof(int) == 8 (64bit) due to --format=u
Sep
27
awarded  Yearling
Sep
27
revised How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
update random generator to correspond to the question
Sep
27
suggested approved edit on How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?
Sep
27
accepted How to convert an unsigned decimal (less than 1<<32) to 4 bytes (binary) in bash?