Skip to content

Instantly share code, notes, and snippets.

@tobernguyen
tobernguyen / setup-amazon-time-sync.sh
Last active March 24, 2021 22:56
Setup Amazon Time Sync on Ubuntu EC2
#!/bin/bash
set -xe
# Install Chrony and use Amazon Time Sync Service
sudo apt install chrony -y
sudo sed -i '1s;^;server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4\n;' /etc/chrony/chrony.conf
sudo /etc/init.d/chrony restart
# For install verification
sleep 5

Keybase proof

I hereby claim:

  • I am tobernguyen on github.
  • I am longn (https://keybase.io/longn) on keybase.
  • I have a public key ASCbtYijrvzR2rc4uQANAyRN1FfnfIiHgzS_7jLSH6oJQgo

To claim this, I am signing this object:

@tobernguyen
tobernguyen / index.js
Created April 29, 2018 18:15
Get list of all users in Telegram channel / supergroup
/*
* MIT License
*
* Copyright (c) 2017-2018 Bannerets <save14@protonmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
import React from 'react';
import PropTypes from 'prop-types';
import Immutable from 'immutable';
import styled from 'styled-components';
import { Link } from 'react-router';
import ViewBranchListPanel from '../../components/ViewBranchListPanel';
import './styles.scss';
const TableList = styled.ul`
padding-left: 0;
import { createSelector } from 'reselect';
const selectMenusDomain = () => (state) => state.get('menus');
const selectRestaurantMenus = () => createSelector(
selectMenusDomain(),
(menusState) => menusState.get('menus')
);
const selectActiveMenu = () => createSelector(
import { fromJS, List } from 'immutable';
import camelize from 'camelize';
import {
GET_RESTAURANT_MENUS_REQUEST,
GET_RESTAURANT_MENUS_SUCCESS,
GET_RESTAURANT_MENUS_ERROR,
SET_ACTIVE_MENU_CONTAINER_ID,
SET_ACTIVE_MENU_ITEM_ID,
PUT_UPDATE_MENU_CONTAINER_REQUEST,
PUT_UPDATE_MENU_CONTAINER_SUCCESS,
import { fromJS } from 'immutable';
import {
SIGN_IN_BY_EMAIL_REQUEST,
SIGN_IN_BY_EMAIL_SUCCESS,
SIGN_IN_BY_EMAIL_ERROR,
} from './constants';
const initialState = fromJS({
error: null,
user: null,
@tobernguyen
tobernguyen / deploy_rails_app.md
Last active December 31, 2023 21:05
Ruby on Rails Deployment on DigitalOcean

Ruby on Rails Deployment on DigitalOcean

Prequisites

  • HTTP server nginx
  • Rails web server passenger
  • Database PosgreSQL
  • Deployment utility mina

Step 1 - Create your droplet