Skip to content

Instantly share code, notes, and snippets.

alexlee-gk /
Last active Sep 22, 2020
Use integrated graphics for display and NVIDIA GPU for CUDA on Ubuntu 14.04

This was tested on a ThinkPad P70 laptop with an Intel integrated graphics and an NVIDIA GPU:

lspci | egrep 'VGA|3D'
00:02.0 VGA compatible controller: Intel Corporation Device 191b (rev 06)
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M3000M] (rev a1)

A reason to use the integrated graphics for display is if installing the NVIDIA drivers causes the display to stop working properly. In my case, Ubuntu would get stuck in a login loop after installing the NVIDIA drivers. This happened regardless if I installed the drivers from the "Additional Drivers" tab in "System Settings" or the ppa:graphics-drivers/ppa in the command-line.

fnhipster / html5.haml
Created Apr 9, 2011
HTML5 HAML Template
View html5.haml
!!! 5
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }
eladnava /
Last active Sep 22, 2020
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
# Make sure to:
# 1) Name this file `` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x
# 7) Test it out via ./
bradtraversy /
Last active Sep 22, 2020
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months)

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

matteocrippa /
Last active Sep 22, 2020
a script to quick setup my dev Mac
#!/usr/bin/env bash
echo "Install XCode first"
xcode-select --install
# Setup directories
mkdir ~/Projects
mkdir ~/Projects/Repositories
mkdir ~/Projects/Material
GetoXs / ServiceCollectionExtentions.cs
Last active Sep 22, 2020
Register All Types (with Generic) in .NET Core DependencyInjection
View ServiceCollectionExtentions.cs
using System;
using System.Linq;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionExtentions
public static void AddAllTypes<T>(this IServiceCollection services
, Assembly[] assemblies
, bool additionalRegisterTypesByThemself = false
dodo5522 /
Last active Sep 22, 2020
Python script to upload a photo into flickr.
#!/usr/bin/env python2
# -*- encoding:utf-8 -*-
from __future__ import print_function
import argparse
import datetime
import exifread
import flickrapi
import os
import sys
Villanuevand / README-españ
Last active Sep 22, 2020
Una plantilla para hacer un buen Inspirado en el gist de @PurpleBooth =>
View README-españ

Título del Proyecto

Acá va un párrafo que describa lo que es el proyecto

Comenzando 🚀

Estas instrucciones te permitirán obtener una copia del proyecto en funcionamiento en tu máquina local para propósitos de desarrollo y pruebas.

Mira Deployment para conocer como desplegar el proyecto.

AliSoftware / struct_vs_inheritance.swift
Last active Sep 22, 2020
Swift, Struct & Inheritance: How to balance the will of using Struct & Value Types and the need for Inheritance?
View struct_vs_inheritance.swift
// #!Swift-1.1
import Foundation
// MARK: - (1) classes
// Solution 1:
// - Use classes instead of struct
// Issue: Violate the concept of moving model to the value layer
ruanbekker /
Last active Sep 22, 2020
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
You can’t perform that action at this time.