Recently shared snippets
import math E=3 T=40**E D=10**E def nu(): for c in range(-T,T): yield c/D def fu(n): r=n**n if isinstance(r,float):return r else:return "" def va(): for n in nu(): yield fu(n) def vb(): for n in nu(): yield fu(n+1/D) def d(n):return int(n*D) def inv(n): for a,b,r in zip(va(),vb(),nu()): if a=="" or b=="":continue if (d(a)<=d(n)<=d(b))or(d(b)<=d(n)<=d(a)):yield d(r)/D while True: i=float(input()) s="" for r in inv(i): if fu(r)==i:s+="=" s+=str(r) s+="\n" print(s)
LocalDateTime time = LocalDateTime.now(); LocalDateTime nextHour = time.plus(1l, ChronoUnit.HOURS).truncatedTo(ChronoUnit.HOURS) .plusMinutes(60 * (time.getMinute() / 60)); long minutes = Duration.between(LocalDateTime.now(), nextHour).toMinutes();
import org.apache.commons.lang3.StringUtils; .... List<String> filteredAndTrimmed = Arrays.asList("abc ", " cd", "", "gh").stream().map(StringUtils::trim).filter(StringUtils::isNotBlank) .collect(Collectors.toList()); filteredAndTrimmed.forEach(System.out::println); //output is abc cd gh
Read your programming book as normal. When you get to a code sample, read it over Then close the book. Then try to type it up. Simple, right? But try it and watch as you’re forced to learn some of the structure of the code. It’s a lot like the way you may have already been doing it, just with more learning.
If your site puts the username in the URL of the user’s profile page, what would happen if I created a user named login? If I were to populate my profile with the text “Our log-in page has moved, please click here to log in”, with a link to my credential-harvesting site, how many of your users do you think I could fool? If your site creates email addresses from usernames, what happens if I sign up as a user named webmaster or postmaster? Will I get email directed to those addresses for your domain? Could I potentially obtain an SSL certificate for your domain with the right username and auto-created email address? If your site creates subdomains from usernames, what happens if I sign up as a user named www? Or smtp or mail?