This file contains 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 static T Parse<T>(string value) | |
{ | |
return (T)Enum.Parse(typeof(T), value, true); | |
} | |
public static IEnumerable<T> GetValues<T>() | |
{ | |
return Enum.GetValues(typeof(T)).Cast<T>(); | |
} |
This file contains 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
xdg-open . |
This file contains 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
#!/bin/bash | |
if (xrandr | grep "DP-0 connected" > /dev/null) | |
then | |
exec echo "Conected" & | |
exec xrandr --output DP-0 --mode 2560x1440 --rate 120.00 & | |
exec xrandr --output DP-2 --off & | |
exit | |
fi% |
This file contains 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
sudo wpa_supplicant -B -Dwext -i wlp0s20u2 -c /etc/wpa_supplicant.conf |
This file contains 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
[keyfile] | |
unmanaged-devices=interface-name:wls1 |
This file contains 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
const http = require('http'); | |
function get(url) { | |
return new Promise((resolve, reject) => { | |
http.get(url, (res) => { | |
let data = ''; | |
res.on('data', (chunk) => { | |
data += chunk; | |
}); |
This file contains 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
function post(opts, data, sucFn, errFn, type) { | |
var postDataStr = JSON.stringify(data); | |
console.log('=== postDataStr ===', postDataStr); | |
var optsPost = { | |
hostname: opts.host, | |
port: opts.port ? opts.port : 80, | |
path: opts.path, | |
method: (type || 'POST'), |
This file contains 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
const variablePattern = /\${([^}]*)}/g; | |
module.exports = { | |
format: (normalStringTemplate, values) => { | |
const replacedStr = normalStringTemplate.replace(variablePattern, (match, p1) => values[p1.trim()]); | |
const templateStr = `${replacedStr}`; | |
return templateStr; | |
}, | |
listVariables: (normalStringTemplate) => { | |
const pattern = /\${([^}]*)}/g; |
This file contains 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
# Install k3s | |
# Build Dockerfile | |
docker build . -t simplejob:v1.0.0 | |
# save to a tar file | |
docker save --output simplejob-v1.0.0.tar simplejob:v1.0.0 | |
# create a yaml with dry-run | |
kubectl create cronjob simplejob --image=simplejob --schedule="*/1 * * * *" --dry-run=client -o yaml |