###tcpdump: tcpdump -lnnvi any -w tcpdump-xvm18.out -s 0
###To list all open ports and their processes: sudo netstat -lpAinet
###To get ips without hostnames: sudo netstat -lpnAinet
###To list only what's using tcp port 443:
###tcpdump: tcpdump -lnnvi any -w tcpdump-xvm18.out -s 0
###To list all open ports and their processes: sudo netstat -lpAinet
###To get ips without hostnames: sudo netstat -lpnAinet
###To list only what's using tcp port 443:
// Init | |
new String[]{"a", "b"} | |
List<String> list = new ArrayList<String>( | |
Arrays.asList("String A", "String B", "String C") | |
); | |
Map<String, Owner> owners = new HashMap<String, Owner>() {{ | |
put("no-money", createOwnerWithoutMoney()); |
# Run only failed test on cucumber | |
mvn test -Dcucumber.options="@target/cucumber-failed.txt" | |
# Run only a feature on cucumber | |
mvn clean test -Dcucumber.options="/path/to/feature:37" | |
or | |
mvn clean test -Dcucumber.options="--tags @NonGeoLocatedBid" |
###Remove a merged branch git branch -d BRANCH
git push origin --delete BRANCH
git checkout develop
var groups =_.groupBy(categories, _.curry(_.has)(_, 'id')); |
### Clone collection from remote host | |
mongo | |
use <database> | |
db.cloneCollection("remote.host:27017", "<collection>") |
# Turn a List<> into String[] | |
String[] strings = list.stream().toArray(String[]::new); | |
# Reduce by collecting over a field | |
list.stream().collect(Collectors.mapping( | |
Person::getName, | |
Collectors.toList())), | |
# Run several tasks asynchronously and wait for them | |
CompletableFuture<Map<String, List<String>>> campaignsByGeohashWithLocationsFuture = |
const http = require('http'); | |
const SocketIO = require('socket.io') | |
const server = http.createServer(function (req, res) { | |
... | |
}); | |
const io = SocketIO(server); | |
io.on('connection', (socket) => { | |
socket.emit('tic', { seconds: 0 }); |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
const socket = io('http://localhost:3000'); | |
socket.on('tic', (data) => { | |
console.log(data); | |
data.seconds++; | |
socket.emit('tac', data); | |
}); | |
</script> |