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
// gcc getifaddrs_linux.c -o getifaddrs_linux | |
// ./getifaddrs_linux | |
// https://stackoverflow.com/a/12878352 | |
#include <stdlib.h> //exit() | |
#include <stdio.h> //printf(),perror() | |
#include <string.h> //memset | |
#include <ifaddrs.h> //struct ifaddrs,getifaddrs() | |
#include <arpa/inet.h> //INET6_ADDRSTRLEN,inet_ntop() | |
#include <netinet/in.h> //sockaddr_in,sockaddr_in6 |
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/sh | |
# keep ssh shell alive | |
# https://stackoverflow.com/a/29458738/8706476 | |
ssh ubuntu@xxxx -o ServerAliveInterval=60 |
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/sh | |
# https://ubuntu.com/server/docs/service-nfs | |
# client | |
# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/reference_guide/s2-nfs-client-config-options | |
sudo mount 172.16.0.7:/home/ubuntu/nfsroot /opt/172-16-0-7/ -o nfsvers=2 | |
cat /proc/mounts | grep nfsroot | |
cat /opt/172-16-0-7/README.md | |
# sudo umount /opt/172-16-0-7/ |
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
# http://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning | |
# tested on macOS | |
echo https://github.com/torvalds/linux.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -I{} curl -s -k https://api.github.com/repos/'{}' | grep size | |
# output: | |
# "size": 1746294, |