Source: http://willandorla.com/will/2011/01/convert-folder-into-git-submodule/
$ git clone --no-hardlinks original-repo copied-repo
Source: http://willandorla.com/will/2011/01/convert-folder-into-git-submodule/
$ git clone --no-hardlinks original-repo copied-repo
When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.
In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is 10.0.0.0/8. Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN:
set -x | |
function fix_content_root() { | |
local in_directory="$1" | |
local targets=($(grep -E -l --include \*.iml '<content url="file://\$MODULE_DIR\$/(\.\./)+src/main/resources"' -r ${in_directory} | grep -v 'fixContentRoot.sh')) | |
for target in ${targets[@]}; do | |
echo ${target}; | |
sed -Ei 's#<content url="file://\$MODULE_DIR\$/(\.\./)+src/main/resources" />##g' ${target}; | |
sed -i '/<content url="file:\/\/$MODULE_DIR$\/..\/src\/main\/resources">/{:a;N;/<\/content>/!ba};/<sourceFolder url="file:\/\/$MODULE_DIR$\/..\/src\/main\/resources" type="java-resource" \/>/d' ${target}; | |
sed -i '/<content url="file:\/\/$MODULE_DIR$\/..\/..\/src\/main\/resources">/{:a;N;/<\/content>/!ba};/<sourceFolder url="file:\/\/$MODULE_DIR$\/..\/..\/src\/main\/resources" type="java-resource" \/>/d' ${target}; |
docker run \ | |
--name={{.Name}} \ | |
{{range $e := .Config.Env}}--env={{printf "%q" $e}} \ | |
{{end}}{{range $p, $conf := .NetworkSettings.Ports}}{{with $conf}}-p {{(index $conf 0).HostIp}}:{{(index $conf 0).HostPort}}:{{$p}} \ | |
{{end}}{{end}}{{range $n, $conf := .NetworkSettings.Networks}}{{with $conf}}--network {{printf "%q" $n}} \ | |
{{range $conf.Aliases}}--network-alias {{printf "%q" .}} {{end}} \ | |
{{end}}{{end}}{{range $v := .HostConfig.VolumesFrom}}--volumes-from={{printf "%q" .}} \ | |
{{end}}{{range $v := .HostConfig.Binds}}--volume={{printf "%q" .}} \ | |
{{end}}{{range $l, $v := .Config.Labels}}--label {{printf "%q" $l}}={{printf "%q" $v}} \ | |
{{end}}{{range $v := .HostConfig.CapAdd}}--cap-add {{printf "%q" .}} \ |
Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).
docker run -it --rm --privileged --pid=host justincormack/nsenter1
more info: https://github.com/justincormack/nsenter1
// jshell -v --add-modules=java.net.http http_request.jsh | |
import java.net.*; | |
import java.net.http.*; | |
HttpClient httpClient = HttpClient.newHttpClient(); | |
HttpRequest httpRequest = HttpRequest.newBuilder().uri(new URI("https://graph.facebook.com/v2.9/me?fields=id,email,cover,first_name,gender,last_name,link,locale,name,timezone,updated_time,verified,friends&access_token=change_it&appsecret_proof=change_it&method=get&format=json")).GET().build(); | |
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString()); | |
System.out.println(httpResponse.statusCode()); | |
System.out.println(httpResponse.body()); |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
1. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty | |
2. when done use CTRL-A CTRL-\ and then y (for yes) to exit | |
Alternative method: | |
1. docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh | |