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
#!/usr/bin/env bash | |
function getNodes() { | |
kubectl get --raw=/api/v1/nodes | jq -r '.items[].metadata.name' | |
} | |
function getPVCs() { | |
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\ | |
'{name: .pvcRef.name, capacityBytes, usedBytes, availableBytes, '\ | |
'percentageUsed: (.usedBytes / .capacityBytes * 100)}] | sort_by(.name)' |
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
# list all nodes | |
kubectl get nodes | |
# list all pods of specified node | |
kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<node-name> |
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
kubectl get pods --all-namespaces | grep Error | awk '{print $2, "--namespace", $1}' | xargs kubectl delete pod |
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 io.micronaut.context.annotation.ConfigurationProperties; | |
import java.net.URI; | |
@ConfigurationProperties("micronaut.http.services.my-service") | |
public class MyServiceConfiguration { | |
public static final String ID = "my-service"; | |
private URI url; | |
public URI getUrl() { |
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 java.util.Map; | |
public class RomanToInteger { | |
private static final Map<Character, Integer> symbols = | |
Map.of('I', 1, 'V', 5, 'X', 10, 'L', 50, 'C', 100, 'D', 500, 'M', 1000); | |
public int convert(String romanNumeral) { | |
int result = 0; | |
for (int i = 0; i < romanNumeral.length(); i++) { | |
char currentChar = romanNumeral.charAt(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
import java.time.Duration; | |
import java.time.Instant; | |
public class LongestCommonSubsequence { | |
public int lcsRecursive(char[] a, char[] b, int i, int j) { | |
if (a.length == i || b.length == j) | |
return 0; | |
else if (a[i] == b[j]) | |
return 1 + lcsRecursive(a, b, i + 1, j + 1); | |
else |
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
Reference: https://www.raspberrypi.org/forums/viewtopic.php?t=34061 | |
The Pi outputs a relatively weak HDMI signal. Some devices may not immediately notice the Pi's HDMI or may not do the negotiation. | |
Setting the hdmi_force_hotplug=1 makes sure the Pi believes the monitor/TV is really there. | |
You might also need to set config_hdmi_boost=4 or even higher (up to 9) if your display needs a stronger signal. | |
If the display is a computer monitor, use hdmi_group=1 and if it is an older TV, try hdmi_group=2. | |
Do not set hdmi_safe=1 as that overrides many of the previous options. | |
Using a shorter or better quality HDMI cable might help. | |
Make sure your Pi's power supply delivers 1A and not 500mA. | |
If you see a problem with the red colour - either absent, or interference - then try a boost. However it might simply be that the display requires a stronger signal than the Pi can give. |
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
# Reference: https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html | |
# Solution 2 fixed my problem (below) | |
echo "options snd-hda-intel dmic_detect=0" | sudo tee -a /etc/modprobe.d/alsa-base.conf | |
echo "blacklist snd_soc_skl" | sudo tee -a /etc/modprobe.d/blacklist.conf | |
# Reboot your system |
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
kubectl get namespaces | |
kubectl get pods -n <namespace> | |
kubectl logs pod/<pod_name> -n <namespace> | |
kubectl describe pod/<pod_name> -n <namespace> |
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 java.util.stream.IntStream | |
fun stair(n: Int) { | |
IntStream.range(1, n).forEach { | |
println(" ".repeat(n - it) + "#".repeat(it)) | |
} | |
} | |
fun main() { | |
print("Enter the stair size: ") |