Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# pick only branch name
awk -F"\torigin/" '{print $NF}' branches.txt > branches_trancated.txt
# Make it a space seperated single line
awk '$1=$1' ORS=' ' branches_trancated.txt > branches_space.txt
# cleanup
rm -f branches.txt branches_trancated.txt
#!/bin/bash
GREEN='\033[0;32m';
NC='\033[0m';
nameFromConfig=`git config --global user.name`;
echo Enter your git name [$nameFromConfig]:
read name
if [ -z "$name" ]
then
name=${nameFromConfig}
version: "3.0"
services:
webapp:
build:
context: ../webapp
volumes:
- ../webapp:/usr/src/app
links:
FROM node:carbon
# Create app directory
RUN mkdir -p /usr/src/app
RUN chmod -R 777 /usr/src/app
WORKDIR /usr/src/app
# Copy code
COPY package.json /usr/src/app/
brew install dnsmasq
sudo echo 'address=/.test/127.0.0.1' >> /usr/local/etc/dnsmasq.conf
sudo mkdir -p /etc/resolver
echo 'nameserver 127.0.0.1' | sudo tee /etc/resolver/test
sudo brew services restart dnsmasq
version: '3'
services:
server1:
image: httpd:alpine
environment:
- VIRTUAL_HOST=server1.test
server2:
image: httpd:alpine
environment:
- VIRTUAL_HOST=server2.test
version: '3'
services:
server1:
image: httpd:alpine
ports:
- 8080:80
server2:
image: httpd:alpine
ports:
- 8081:80
const path = require('path');
const paths = {
BUILD: path.resolve(__dirname, 'build'),
SRC: path.resolve(__dirname, 'src')
};
module.exports = {
entry: path.join(paths.SRC, 'app.js'),
output: {
@skeep
skeep / Dijkstra.js
Last active August 13, 2018 19:43
Dijkstra's algorithm is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks. It was conceived by computer scientist Edsger W. Dijkstra in 1956 and published three years later. This programme is an implementation of https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm#Pseudocode
/**
* Basic Graph data structure implementation
* @constructor
*/
var Graph = function() {
this.vertices = {};
};
Graph.prototype.add = function(name, edges) {
edges = edges || null;
@skeep
skeep / git-branches-by-commit-date.sh
Created May 26, 2016 06:37 — forked from l15n/git-branches-by-commit-date.sh
List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r