Skip to content

Instantly share code, notes, and snippets.

@milingo
milingo / bash.md
Last active April 21, 2017 08:19
Useful shell commands

###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());
@milingo
milingo / integration
Last active May 29, 2017 11:01
Unit Tests in Java
# 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"
@milingo
milingo / git.md
Last active January 29, 2016 09:56
Git

Tutorial

###Remove a merged branch git branch -d BRANCH

git push origin --delete BRANCH

Merge develop with feature branch

git checkout develop

@milingo
milingo / cool.js
Last active September 3, 2015 08:42
javascript lessons
var groups =_.groupBy(categories, _.curry(_.has)(_, 'id'));
@milingo
milingo / mongo.js
Created December 2, 2014 14:44
mongodb cheatsheet
### 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 =
@milingo
milingo / new_gist_file.md
Last active August 29, 2015 14:16
Html Box Model

Box Model

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>