Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Scaevolus
Apr 16, 2007

AlsoD posted:

So one fix to this could be to give tuples a sugar, much like as is done for lists currently, so that n-tuples are actually n nested 2-tuples (i.e. a heterogeneous list).

Having recursive heterogeneous lists is nontrivial.

Duplicating some code 15 times is annoying, but that's far simpler than 5 type system extensions to express nested 2-tuples. And if you have tuples more than 15 long, your program is probably a complete mess anyways.

Adbot
ADBOT LOVES YOU

Scaevolus
Apr 16, 2007

tractor fanatic posted:

Is it intractable to write a formally proven TLS library in C, or is mathematical correctness just not a high priority?

There's a formally proven TLS library in F#, miTLS.

Proving semantics is much easier in a functional language with a garbage collector. It's possible that miTLS could be "lowered" to C, but it would require carefully proving each step of the translation.

There are other attempts at formally verifying C programs like Frama-C which might be applicable as well.

Scaevolus
Apr 16, 2007

Apparently /dev/urandom has a spinlock that kills performance when read by multiple threads simultaneously.

But this is by design, according to the author:

Theodore Ts'o posted:

Doctor, doctor it hurts when I do this. Well, then don't do that!

The reason for the spinlock is to avoid having two reads from /dev/urandom return the same results. That would be undesirable...

If people are trying to read from /dev/urandom a huge number of times per second, then they're doing something wrong. The real issue, as Sebastian has pointed out, is that issue spawning a huge number of curl processes for each request. Then hopefully curl is using /dev/urandom to initialize its own userspace RNG (many crypto libraries do this; most *should* do this), so you're not trying to read from /dev/urandom for every single request. /dev/urandom is designed for security, not for speed.

(hint: you can get security AND speed simultaneously)

Scaevolus
Apr 16, 2007

Deus Rex posted:

Golang has (significantly less-retarded) ASI as well.
Plus it's the only style anyone writes Go in, so you don't have maverick JS developers writing semicolon-free code arguing with the mainstream.

Effective Go posted:

The rule is this. If the last token before a newline is an identifier (which includes words like int and float64), a basic literal such as a number or string constant, or one of the tokens

break continue fallthrough return ++ -- ) }

the lexer always inserts a semicolon after the token. This could be summarized as, “if the newline comes after a token that could end a statement, insert a semicolon”.

Scaevolus
Apr 16, 2007

CodeBabes and CodeDicks

Scaevolus
Apr 16, 2007

Apps aren't killed immediately when you switch away from them or hit back.

Some terribly programmed games (Ridiculous Fish) will peg the CPU regardless of if they're in the foreground (or if the screen is even on).

Scaevolus
Apr 16, 2007

Buildbot posted:

Properties load speedup

For example, if most of your build properties are strings, you can gain an approx. 30% speedup if you put this snippet of code inside your master.cfg file:
Python code:
def speedup_json_loads():
    import json, re

    original_decode = json._default_decoder.decode
    my_regexp = re.compile(r'^\[\"([^"]*)\",\s+\"([^"]*)\"\]$')
    def decode_with_re(str, *args, **kw):
        m = my_regexp.match(str)
        try:
            return list(m.groups())
        except:
            return original_decode(str, *args, **kw)
    json._default_decoder.decode = decode_with_re

speedup_json_loads()
Buildbot Optimization

Scaevolus
Apr 16, 2007

code:
var commandProbability = 0.03; //This is actually ~2% because Math.random doesn't include 1.0
var commandThreshold = Math.random() + commandProbability;

if (commandThreshold > 1) {

Scaevolus
Apr 16, 2007

wilderthanmild posted:

Rather than like actually validating the date it just checked that it was 57 characters long.

For example:

Thu Aug 05 2021 12:20:23 GMT-0400 (Eastern Daylight Time)

The problem with this is obviously that other time zones exist, so that portion inside the parentheses changes length. So now that we're hiring remote workers outside of Central, Pacific, and Eastern timezones, which are all conveniently the same length, a bunch of forms that used this code are broken.

I appreciate your company's dedication to not having anyone in Mountain time.

Adbot
ADBOT LOVES YOU

Scaevolus
Apr 16, 2007

https://github.com/maleesha2005/smsspammer/blob/050ab98191e9b64e470c02d0043697dd5c3b1649/smsspammer.py#L19
Python code:
try:
	from requests import post,get;from colorama import Fore,init,Style
except ModuleNotFoundError:
	print('\x1b[91m[!] Required Modules Aren\'t Installed!')
	time.sleep(1)
	print('\x1b[34m[*] Installing...')
	os.system('pip3 install requests colorama')
	print('\x1b[92m[+] Required Modules Installed!')
	os.system('clear')

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply