Skip to content

Instantly share code, notes, and snippets.

View nguyentamvinhlong's full-sized avatar

Tam Nguyen nguyentamvinhlong

View GitHub Profile
@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.
@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

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 / 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

@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 / 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 / ElasticSearch.sh
Last active August 29, 2015 14:26 — forked from ricardo-rossi/ElasticSearch.sh
Installing ElasticSearch on Ubuntu 14.04
### USAGE
###
### ./ElasticSearch.sh 1.5.0 will install Elasticsearch 1.5.0
### ./ElasticSearch.sh 1.4.4 will install Elasticsearch 1.4.4
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version

All binary can be downloaded http://pan.baidu.com/s/1hqH2Pko

Sublime Text 3, build 3083 (dev) for Windows x64

OFFSET ORIGINAL CRACKED
0xe21b3 85 3B

md5:c3522c719d24f85dd770c93b9bf9e56f

git rm -r --cached .
Followed by:
git add .
and
git commit -m "fixed untracked files"
This should fix your problem.

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

  • Modify your app to use multiple Heroku buildpacks.
  • Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
  • Confirm that everything worked.