This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# About | |
macOS Sierra ships with PF (Packet Filter, also written pf) a BSD licensed stateful packet filter, | |
a central piece of software for firewalling. It is comparable to netfilter (iptables), ipfw and ipfilter. | |
[quoted from wikipedia] | |
We need Apache Tomcat for development. It run uses the standard unprivileged 8080 and 8443 ports. | |
To make development easier we set up port forwarding. | |
# Port Forwarding on macOS Sierra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am raupachz on github. | |
* I am raupach (https://keybase.io/raupach) on keybase. | |
* I have a public key ASA5aglR8YssRwA-urEoMtWr9b2om5Y6mesKsEk7PnCvMAo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQENBFvG7WkBCADAsVVUwImdMMbsoeNLlJvOckeNNnkC2tzR24AEBc0FUSBj0CcH | |
n6iJIJR/V3C4QIlbf+WHp8AyNV7wZnKS0BeM/lGRqWQwhI3ThQOz7tMBl3nPBBJ2 | |
xiHAyXUtIRlCN5q1z0ZuaOH/1Ncd5oDA52oIl+eRLXaEF+fDhIJtBgf3FdEdtvKD | |
E73bVsf3sVigH5Q4Uvs6sTfdk8n/rIo4RZf2jkWDHvd/FW3xKqyGeDE+Gk53ofIv | |
wbhDNtGXcpaSycoysIlkJzb4u5GXyOA+ivq0iVKNpMg4jr8K2n1qRO2fdUPhlGOB | |
DlQPSNIVRhDvgFPHO7DYUoAn5JNa7pvQfJHBABEBAAG0GXJhdXBhY2ggPHJhdXBh | |
Y2hAdHdpdHRlcj6JAVQEEwEIAD4WIQQypcPuCKuHAN3VFkbKMNoulCXM4gUCW8bt | |
aQIbAwUJAeEzgAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDKMNoulCXM4jmo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.sun.mail.smtp.SMTPTransport; | |
import java.io.IOException; | |
import java.util.Properties; | |
import javax.mail.Message; | |
import javax.mail.MessagingException; | |
import javax.mail.Session; | |
import javax.mail.internet.InternetAddress; | |
import javax.mail.internet.MimeMessage; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Prime { | |
public int nth(int n) { | |
int p = 2; | |
for (int i = 0; i < n; ) { | |
if (prime(p++)) { | |
i++; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cores { | |
public Integer handle(Object o) { | |
return Runtime.getRuntime().availableProcessors(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.services.lambda.runtime.Context; | |
import com.amazonaws.services.lambda.runtime.RequestHandler; | |
public class LambdaFunction implements RequestHandler<Void, String> { | |
private final long classloaderTime = System.currentTimeMillis(); | |
private final long constructorTime; | |
private long methodTime; | |
public LambdaFunction() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JWT { | |
private static ObjectMapper objectMapper = new ObjectMapper(); | |
public static Map<String, Object> of(String token) { | |
String[] parts = token.split("\\."); | |
String payload = parts[1]; | |
String json = new String(Base64.getUrlDecoder().decode(payload), StandardCharsets.UTF_8); | |
TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {}; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Named | |
@SessionScoped | |
public class UserBean implements Serializable { | |
private Map<String, Object> claims; | |
@PostConstruct | |
public void postConstruct() { | |
FacesContext facesContext = FacesContext.getCurrentInstance(); | |
HttpServletRequest httpServletRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest(); |
OlderNewer