Skip to content

Instantly share code, notes, and snippets.

View nguyentamvinhlong's full-sized avatar

Tam Nguyen nguyentamvinhlong

View GitHub Profile
@nguyentamvinhlong
nguyentamvinhlong / backup.sh
Last active August 29, 2015 14:26 — forked from nherment/backup.sh
Backup and restore an Elastic search index (shamelessly copied from http://tech.superhappykittymeow.com/?p=296)
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@nguyentamvinhlong
nguyentamvinhlong / angularjs-filters.html
Last active August 29, 2015 14:27 — forked from sivaprasadreddy/angularjs-filters.html
AngularJS filters final HTML
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My AngularJS App</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
@nguyentamvinhlong
nguyentamvinhlong / Rails_Models_Cheatsheet.md
Last active December 5, 2015 03:21 — forked from rstacruz/index.md
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

Scrape medium posts

Just add suffix ?format=json to medium url

Example:

https://medium.com/hacking-and-gonzo/how-hacker-news-ranking-algorithm-works-1d9b0cf2c08d?format=json

To get user's latest posts

@nguyentamvinhlong
nguyentamvinhlong / rabbitmq-server-change-hostname.md
Last active July 8, 2021 16:49
rabbitmq-server change hostname

rabbitmq-server change hostname

Remove the old installation of RabbitMQ to fix this problem. Here are steps to reinstall RabbitMQ. These commands are run as the root user:

Stop RabbitMQ:

rabbitmqctl stop

Change

@nguyentamvinhlong
nguyentamvinhlong / gitlab-permission-denied-publickey-error-solved.md
Created October 10, 2017 15:44
Gitlab Permission denied (publickey) error SOLVED

Gitlab Permission denied (publickey) error SOLVED

Permission denied (publickey)

Seems a very common error in Gitlab.com or any Gitlab implementation. Last night I spend 4/5 hours without sleeping to solve the error.

Cloning into 'server'...
Permission denied (publickey).
fatal: Could not read from remote repository.