Skip to content

Instantly share code, notes, and snippets.

@Gamblt
Gamblt / install-docker.sh
Created November 7, 2018 16:42 — forked from frgomes/install-docker.sh
Debian - install docker in Debian Jessie
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@Gamblt
Gamblt / auto-restart-nodejs-process
Created July 10, 2018 08:40 — forked from luozhihua/auto-restart-nodejs-process
Auto restart nodejs process when program exit
var child_process = require('child_process');
start();
function start(nodefile) {
if (typeof start !== 'string') {
console.log('Has none file. like this: start("app.js")');
}
console.log('Master process is running.');
@Gamblt
Gamblt / isElementInViewport.js
Created May 8, 2018 08:50 — forked from davidtheclark/isElementInViewport.js
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
@Gamblt
Gamblt / syslog-ng.conf
Created May 8, 2018 08:30 — forked from caquino/syslog-ng.conf
syslog nginx configuration
source s_nginx_20 { pipe("/srv/logs/access.log" program_override("nginx-access-log")); };
source s_nginx_21 { pipe("/srv/logs/error.log" program_override("nginx-error-log")); };
filter f_nginx_20 { match("nginx-access-log" value("PROGRAM")); };
filter f_nginx_21 { match("nginx-error-log" value("PROGRAM")); };
destination d_remote { tcp("central.syslog", port(514)); };
log { source(s_nginx_20); filter(f_nginx_20); destination(d_messages); };
log { source(s_nginx_21); filter(f_nginx_21); destination(d_messages); };
@Gamblt
Gamblt / notes.md
Created April 12, 2018 08:09 — forked from inecmc/notes.md
How to run multiple Redis instances on Ubuntu 16.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf
How to install and run Headless nightmare.js based scripts in Ubuntu.
Steps:
1. Spin Ubuntu 16.04 x64 server
2. Run: apt-get update
3. Run: apt-get upgrade
4. Run: apt-get install -y libgtk2.0-0 libgconf-2-4 libasound2 libxtst6 libxss1 libnss3 xvfb
5. Install Node.js 6+. See: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
You can then run your script using this command:
@Gamblt
Gamblt / seo.service.ts
Created November 16, 2017 08:43 — forked from kaaboeld/seo.service.ts
Example working service for adding meta tags to <head/> for angular2-universal. Based on http://blog.devcross.net/2016/04/17/angular-2-universal-seo-friendly-website/
import {Injectable,Inject,ElementRef, Renderer} from '@angular/core';
//import { DOCUMENT } from '@angular/platform/common_dom';
import {DOCUMENT} from '@angular/platform-browser';
@Injectable()
export class SeoService {
private _r: Renderer;
private _el: ElementRef;
private _document: any;
/**
@Gamblt
Gamblt / gist:55d62b6aca3bfcb4a1725ff44b533efd
Created November 28, 2016 10:33 — forked from imkarthikk/gist:772f86858f90efa55687
Graphite, UWSGI and nginx setup on Ubuntu 14.04
# update packages
sudo apt-get update
# install python and graphite dependencies
sudo apt-get install -y python python-dev python-virtualenv libevent-dev python-pip python-cairo python-django-tagging python-twisted python-memcache python-pysqlite2
# install web server
sudo apt-get install -y nginx uwsgi uwsgi-plugin-python
# install postgresql and dependencies
Create sudo user with bash and homedir:
useradd -m -d /home/testuser/ -s /bin/bash -G sudo testuser
######################################################### FILES
Truncate file
truncate -s 0 /var/log/syslog
Find folders and set access for them:
@Gamblt
Gamblt / setup-sublime3-for-angular2.md
Created May 5, 2016 07:53 — forked from dwmkerr/setup-sublime3-for-angular2.md
Quickly setup Sublime Text 3 for Angular 2

Quick Setup for Sublime Text 3 for Angular 2

Easy to remember, easy to forget.

Step 1: Download Sublime Text 3

Sublime Text 3 Download

Step 2: Create a bash shortcut

It's nice to be able to run subl in a terminal.