mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 11:37:35 +00:00
a6baba1b07
The WIN32 CreateProcess() function does not require an .exe or .com suffix in order to spawn an executable. Now that we have Cosmo bash we're no longer so dependent on the cmd.exe prompt.
16 lines
310 B
Bash
Executable file
16 lines
310 B
Bash
Executable file
#!/bin/sh
|
|
exec python -c "
|
|
# -*- coding: utf-8 -*-
|
|
import sys
|
|
from math import *
|
|
x = $*
|
|
s = x < 0
|
|
x = abs(x)
|
|
b = str(bin(x))[2:].replace('L', '')
|
|
n = len(b)
|
|
if n <= 8: n = 8
|
|
elif n <= 16: n = 16
|
|
elif n <= 32: n = 32
|
|
elif n <= 64: n = 64
|
|
sys.stdout.write(('%%s0b%%0%dd' % n) % ('-' if s else '', int(b)))
|
|
"
|