Skip to content

Instantly share code, notes, and snippets.

@Pokom
Pokom / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created May 2, 2018 23:46 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@Pokom
Pokom / monitor_internet_connection.js
Created December 31, 2017 19:41 — forked from ebidel/monitor_internet_connection.js
Puppeteer: monitor status of internet connectivity using headless Chrome
/**
* @author ebidel@ (Eric Bidelman)
* License Apache-2.0
*/
// Uses puppeteer and the browser's online/offline events to monitor connection status.
const util = require('util');
const dns = require('dns');
const puppeteer = require('puppeteer');
@Pokom
Pokom / how-to-add-image-to-gist.md
Created December 29, 2017 20:27 — forked from remarkablemark/how-to-add-image-to-gist.md
How to add an image to a gist

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@Pokom
Pokom / README-Template.md
Created December 12, 2017 12:26 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@Pokom
Pokom / gist:91e96dcf43e4c5bea96d7afffc202b3c
Created October 16, 2017 16:45 — forked from madis/gist:4650014
Testing CORS OPTIONS request with curl
curl \
--verbose \
--request OPTIONS \
http://localhost:8080/re/routestatus/allRoutes \
--header 'Origin: http://localhost:9292' \
--header 'Access-Control-Request-Headers: Origin, Accept, Content-Type' \
--header 'Access-Control-Request-Method: GET'
# http://nils-blum-oeste.net/cors-api-with-oauth2-authentication-using-rails-and-angularjs/#.UQJeLkp4ZyE
@Pokom
Pokom / remove-docker-containers.md
Created August 12, 2017 21:05 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
#cloud-config
# Configures a basic Ubuntu box.
# * Installs a few common packages
# * Disables root login
# * Disables password login
# * Creates a user in the sudo, www-data groups
#
# Follow the log by ssh-ing in and running: `tail -f /var/log/cloud-init-output.log`
apt_update: true
apt_upgrade: true
@Pokom
Pokom / virtuals.js
Created August 1, 2017 12:02
Example of a virtual on a mongoose object
AssetsSchema.virtual('test').get(function () {
return Object.keys(this.licenseNode).reduce(({ prev, key }) => {
if (typeof this.licenseNode[key] === Number && this.licenseNode[key] > 0) {
prev[key] = this.licenseNode[key];
}
return prev;
});
});
@Pokom
Pokom / cloudSettings
Last active July 19, 2017 14:30
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-07-19T14:23:46.033Z","extensionVersion":"v2.8.2"}