// http://docs.groovy-lang.org/latest/html/documentation/grape.html | |
// http://mvnrepository.com/artifact/org.codehaus.groovy.modules.http-builder/http-builder/0.7.1 | |
groovy.grape.Grape.grab(group:'org.codehaus.groovy.modules.http-builder', module:'http-builder', version:'0.7.1') | |
import groovyx.net.http.HTTPBuilder |
task printTaskInputs { | |
doLast { | |
project.getTasks().each { task -> | |
println "--------------------------------------------------------------------------------" | |
println " Task '${project.name}:${task.name}'" | |
println "--------------------------------------------------------------------------------" | |
println "" | |
println "File inputs:" | |
task.inputs.files.each { |
# Move to root directory... | |
cd / | |
mkdir keys | |
cd keys | |
# Generate a self signed certificate for the CA along with a key. | |
mkdir -p ca/private | |
chmod 700 ca/private | |
# NOTE: I'm using -nodes, this means that once anybody gets | |
# their hands on this particular key, they can become this CA. |
# 1. First of all of course get Manjaro: | |
https://manjaro.org/get-manjaro/ | |
# I recommend using Etcher to copy the image to your USB: | |
https://etcher.io/ | |
# 2. Before installing make sure: | |
# - Secure boot is disabled in BIOS | |
# - Your SSD, HDD or NVME drive is set to AHCI instead of RAID | |
# - Fastboot should be on Auto or minimal, but this shouldn't matter to much |
Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.
Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.
Result is defined as Ok or Err. The definition is generic, and both alternatives have
Do this in cases when you dont want to change the os-level settings, but only want to disable the OOM killer for a single process. This is useful when youre on a shared machine/server.
The OOM killer uses the process level metric called oom_score_adj
to decide if/when to kill a process.
This file is present in /proc/$pid/oom_score_adj
. The oom_score_adj can vary from -1000
to 1000
, by default it is 0.
You can add a large negative score to this file to reduce the probability of your process getting picked and terminated by OOM killer. When you set it to -1000, it can use 100% memory and still avoid getting terminated by OOM killer.
# npm using https for git | |
git config --global url."https://github.com/".insteadOf git@github.com: | |
git config --global url."https://".insteadOf git:// | |
# npm using git for https | |
git config --global url."git@github.com:".insteadOf https://github.com/ | |
git config --global url."git://".insteadOf https:// |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
package enum_example | |
import ( | |
"bytes" | |
"encoding/json" | |
) | |
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred | |
type TaskState int |