Skip to content

Instantly share code, notes, and snippets.

View freekrai's full-sized avatar

Roger Stringer freekrai

View GitHub Profile
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@freekrai
freekrai / gist:5cf5e85456494f5265ce
Created March 9, 2016 00:59 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@freekrai
freekrai / 0_reuse_code.js
Created March 8, 2016 04:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@freekrai
freekrai / install_ruby_1.9.3
Last active February 14, 2016 18:00 — forked from slouma2000/install_ruby_1.9.3
Install Ruby 1.9.3 on CentOS, RedHat using RVM
Step 1: Upgrade Packages
# yum update
# yum -ygroupinstall "Development Tools"
Step 2: Installing Recommended Packages
# yum -y install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum -y install libyaml-devel libffi-devel openssl-devel make
# yum -y install bzip2 autoconf automake libtool bison iconv-devel
Step 3: Install RVM ( Ruby Version Manager )
@freekrai
freekrai / not-bad-code.js
Created January 30, 2016 17:06 — forked from domenic/not-bad-code.js
Avoiding explicit promise construction antipattern
function getUserDetail(username) {
if (userCache[username]) {
return Promise.resolve(userCache[username]);
}
// Use the fetch API to get the information
return fetch('users/' + username + '.json')
.then(function(result) {
userCache[username] = result;
return result;
@freekrai
freekrai / elb-nodejs-ws.md
Created December 29, 2015 00:41 — forked from obolton/elb-nodejs-ws.md
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@freekrai
freekrai / google-inbox-userscript.js
Created December 8, 2015 05:41 — forked from aaronn/google-inbox-userscript.js
Google Inbox for Desktop (Fluid Userscript)
/* This is a FluidApp userscript for Google Inbox for Mac.
Includes options for total badge count and unread badge count.
1) You need the paid version of FluidApp (http://fluidapp.com/)
2) Point Fluid to https://inbox.google.com (I recommend the icon from here: https://medium.com/@chrismessina/create-an-icon-for-google-inbox-in-your-dock-ed269312e3bc)
3) Set the user-agent to Chrome
4) Go to window -> userscript and add click the plus sign under the first table (on the left). Name the item 'Inbox'.
5) In the second table (on the right) click the plus and type in "*inbox.google.com*".
6) Paste the contents of this document into the script area below that.
7) Configure badge count (for total or unread only) in the code below.
@freekrai
freekrai / README.md
Created December 4, 2015 07:04 — forked from debashisbarman/README.md
A Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

#Creating a Twitter bot with Node.js Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

##Tools we need Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@freekrai
freekrai / basics-of-seo-external.md
Last active April 18, 2016 15:41 — forked from mattsandersuk/basics-of-seo-external.md
SEO Best Practice Guidelines

External SEO

External SEO is concerned primarily with how your website is being linked or referred to.

Backlink Profile

Your backlink profile plays a huge role in helping the search engine to understand the quality and trustworthiness of your site.

If a link is from a high quality website, it's likely to be seen as a vote of trust, likewise if the link or the linking website is of a low quality it can have a negative effect. So, with that in mind it's important to make sure where possible that your links are of as high quality as possible.

Links from external websites always play an important role in determining how valuable one website is in comparison to another. Where possible, it's recommended that any external links are altered to reference the new destination URLs. This will save a search engine having to go through a redirect before reaching their final destination, and can therefore mitigate negative effects of additional load speed, algorithmic damping, etc.

@freekrai
freekrai / .travis.yml
Last active September 4, 2015 20:28 — forked from cotsog/.travis.yml
Custom MongoDB version on container infrastructure
sudo: false
env:
global:
- MONGODB_VERSION=2.6.10
install:
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-$MONGODB_VERSION.tgz
- tar xfz mongodb-linux-x86_64-$MONGODB_VERSION.tgz
- export PATH=`pwd`/mongodb-linux-x86_64-$MONGODB_VERSION/bin:$PATH
- mkdir -p data/db
- mongod --dbpath=data/db &