Skip to content

Instantly share code, notes, and snippets.

View hanguyen221's full-sized avatar

Ha Nguyen hanguyen221

View GitHub Profile
@hanguyen221
hanguyen221 / backup_mongo.sh
Created September 13, 2018 02:02
To back up & restore from backup for mongodb.
#! /bin/sh
# replace with address of folder that contains backups
DIR=/Users/nguyen.thanh.ha/Desktop/backupmongo
# remove all backups older than 30 days
find $DIR -mtime +30 -exec rm -rf {} \;
# create new backup for today
mongodump -h <host>:<port> --db <db name> -u <user name> -p <password> --out $DIR/`date +"%Y-%m-%d-%H%M%S"`
@hanguyen221
hanguyen221 / CheckCommentFb.html
Last active May 8, 2018 10:58
Use to check a number is commented or not in a Facebook giveaway post
<!-- Khi dùng thay APP_ID, OBJECT_ID, ACCESS_TOKEN và NUMBER_TO_CHECK -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
@hanguyen221
hanguyen221 / bot.py
Last active September 6, 2017 07:06
Chat bot for facebook messenger
# -*- coding: utf-8 -*-
import sys
import os.path
sys.path.append('/usr/local/lib/python3.6/site-packages')
import fbchat
from fbchat import log, Client # Nạp thư viện của fbchat
from fbchat.models import TypingStatus
import re