Saturday, September 30, 2017
Saturday, September 16, 2017
Auditing file changes in Linux
Audit the file by adding a watch, tail the audit log, remove the watch and list current watches in case you need to remove others.
sudo auditctl -w /path/to/file -p wa sudo tail -f /var/log/audit/audit.log sudo auditctl -W /path/to/file -p wa sudo auditctl -l
Thursday, August 03, 2017
shortcut to get into a kubernetes pod shell
$ grep -B0 -F3 kbash ~/.bashrc
function kbash() {
kubectl exec -ti $1 bash
}
Usage:
kbash some-pod-name-here
Friday, July 28, 2017
Thursday, June 08, 2017
The network folder specified is currently mapped using a different name and password
Getting "The network folder specified is currently mapped using a different name and password. To connect using a different user name and password, first disconnect any existing mappings to this network share"?
This happened to me after a failed attempt to map a path I had no access to with my regular user. Selecting to map it with different credentials kept on complaining with this error message. The solution was to:
This happened to me after a failed attempt to map a path I had no access to with my regular user. Selecting to map it with different credentials kept on complaining with this error message. The solution was to:
- Run 'net use' and if the path is present run 'net /delete \\path\to\resource' and/or 'net /delete $DRIVE_LETTER:'
- Run 'runas /profile /user:$DOMAIN\$USER cmd' for any privileged $USER you have used before. Hopefully is not administrator ;-)
- From the new command prompt pertaining to the privilege user follow the first step
- Try to map the drive again as you would usually do (in my case using the "Connect using different credentials")
tail: inotify cannot be used, reverting to polling: Too many open files
Run 'ps -ef' and look for some processes that might be unusually big in number.
Friday, May 19, 2017
The meaning of VueJS "render: h => h(App)"
What is the meaning of the arrow function defining the 'render' VueJS method?:
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: h => h(App)
})
From https://vuejs.org/v2/guide/render-function.html
Aliasing createElement to h is a common convention you’ll see in the Vue ecosystem and is actually required for JSX. If h is not available in the scope, your app will throw an error.Therefore here is the equivalent of the previous code:
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: function(createElement) {
return createElement(App);
}
})
The arrow function meaning is: let 'render' be a function that accepts the createElement() function as argument and that returns createElement(App) where App is a VueJS single-file-component.
Here is a working example showing the equivalent of this arrow function. Below is the complete code as well:
<!DOCTYPE html>
<html>
<body>
<div id="app">
</div>
<script src="https://unpkg.com/vue@2.3.3"></script>
<script type="text/javascript">
new Vue({
el: '#app',
// render is a function defined here as accepting the function h as parameter and returning the h result when evaluated with a single file component or in this case a template (in here two params: the tag and the value)
render: h => h('h1', 'Hello')
// Same but probably easier to understand for most humans who prefer long but straightforward text rather than short but cryptic:
/*render: function(createElement) {
return createElement('h1', 'Hello');
}*/
})
</script>
</body>
</html>
BTW there is a cryptic-er way to use a single file component (the ES6 spread operator):
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
...App
})
Subscribe to:
Posts (Atom)
