ulimit -c unlimited
nJoy 😉
ulimit -c unlimited
nJoy 😉
This is a simple script to get all cronjbs for all users on a system
for someone in $(cut -f1 -d: /etc/passwd); do echo $someone; crontab -u $someone -l ; done
nJoy 😉
This is as bare a node App as you can make but it comes in handy when you want a . dummy server just to return 200s and or a JSON object at super fast speeds on small systems:
var express = require('express'); var app = express(); app.get('*', function(req, res) { res.sendStatus(200); }); app.listen('3000'); console.log('Magic happens on port 3000'); exports = module.exports = app;Before running the js file runnpm install express
to deploy express..
Thats it !
nJoy 😉
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
logoff and log on
nvm ls-remote nvm install v7.9.0 npm -v node -v
Caveat : Lots of node stuff fails to compile and run on such an old version of linux be warned…
Thats it you now have node and npm installed. nJoy 😉
setup service listener on viewer machine :
while : ; do ffplay -i tcp://192.168.xx.xx:1234?listen ; done
send video to it :
ffmpeg -re -i /dev/video1 -vcodec mpeg2video -f alsa -i hw:2,0 -ac 2 -s 1920×1080 -r 25 -strict -2 -f mpegts tcp://192.168.xx.xx:1234
where
192.168.xx.xx is the IP of the viewer where the ffplay is running.
1234 is the port used.
nJoy 😉
docker run -p 800:80 -p 2222:22 -p 4443:443 -it 68715929d32a /bin/bash
If ports do not work check :
sysctl net.ipv4.ip_forward
if you get:
net.ipv4.ip_forward = 0
then issue :
sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1if you get the error :
docker: Error response from daemon: driver failed programming external connectivity on endpoint amazing_williams (44e256a6039741b20e4124800702d9794d69fb6be9da71ba25059de4dd527121): COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 4443 -j DNAT --to-destination 172.17.0.2:443 ! -i docker0' failed: iptables: <strong>No chain/target/match by that name..</strong>
systemctl stop firewalld systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
yum install iptables-services
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.euserv.net * epel: fr.mirror.babylon.network * extras: ftp.fau.de * updates: centos.fastbull.org Resolving Dependencies --> Running transaction check ---> Package iptables-services.x86_64 0:1.4.21-16.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================================================================= Installing: iptables-services x86_64 1.4.21-16.el7 base 50 k Transaction Summary ============================================================================================================================================================================================================================================= Install 1 Package Total download size: 50 k Installed size: 24 k Is this ok [y/d/N]: y Downloading packages: iptables-services-1.4.21-16.el7.x86_64.rpm | 50 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : iptables-services-1.4.21-16.el7.x86_64 1/1 Verifying : iptables-services-1.4.21-16.el7.x86_64 1/1 Installed: iptables-services.x86_64 0:1.4.21-16.el7 Complete!
systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
try :
docker run -p 800:80 -p 2222:22 -p 4443:443 -it 68715929d32a /bin/bash
You could add the sysctl line to the system or in the /etc/init.d/
pm2 start app.js --log-date-format 'DD-MM HH:mm:ss.SSS'
nJoy 😉
So I need to get information about a particular set of machines in the cloud (AWS).
EC2_INSTANCE_ID="`wget -q -O - http://instance-data/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`" test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id' EC2_AVAIL_ZONE="`wget -q -O - http://instance-data/latest/meta-data/placement/availability-zone || die \"wget availability-zone has failed: $?\"`" test -n "$EC2_AVAIL_ZONE" || die 'cannot obtain availability-zone' EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
nJoy 😉
This is the basic structure for a node.js package file
{
"name": "Express-Basic",
"description": "Demonstrating Express",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x"
}
}
nJoy 😉