Skip to content

Instantly share code, notes, and snippets.

View ngnguyen1's full-sized avatar

Nga Nguyen ngnguyen1

  • FPT - Silicon Labs
  • Hà Nội
  • 10:52 (UTC +07:00)
  • LinkedIn in/nga-nguyen
View GitHub Profile
%% This is linear recursion
plus(X,0) -> X;
plus(X,Y) -> 1 + plus(X,Y-1).
%% This is tail recursion
tail_plus(X,Y) -> tail_plus(X,Y,X).
tail_plus(_,0,Acc) -> Acc;
tail_plus(X,Y,Acc) ->
tail_plus(X,Y-1,1+Acc).
-module(mutual_recursion).
-compile([export_all]).
even(1) -> false;
even(X) -> odd(X-1).
odd(1) -> true;
odd(X) -> even(X-1).
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
[nginx]
name=nginx repo
#baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
Map
.find({
artistId: Utils.convertToObjectId(user._id)
})
.select("nameUrl status mapType created sliders")
.populate({
path: 'sliders',
select: 'name No createdAt works',
populate: [{
path: 'works',
# iptables --list
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
Name: hahah
Architecture: x86_64
Created: 2016/09/01 13:28 UTC
Status: Stopped
Type: persistent
Profiles: default
Log:
lxc 20160901231830.049 INFO lxc_start - start.c:lxc_check_inherited:251 - closed inherited fd 3
@ngnguyen1
ngnguyen1 / .gitconfig
Created February 2, 2018 17:57 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
@ngnguyen1
ngnguyen1 / font.js
Created May 18, 2018 09:46 — forked from andfinally/font.js
Cache webfont in localStorage
/**
* Adapted from https://gist.github.com/hdragomir/8f00ce2581795fd7b1b7
* This version tries to load the font from localStorage. If it's not there it simply adds a link to the stylesheet
* and ajaxes the contents in on load. This makes an extra request. But adding the stylesheet link renders quicker than
* waiting for a response to the ajax request and then injecting the contents into a style tag, hopefully minimising the
* FOUT you get when you view http://www.theguardian.com/ and http://www.smashingmagazine.com.
*/
(function () {
"use strict";
// Once cached the css file is stored on the client forever. To invalidate the cache change this URL.
@ngnguyen1
ngnguyen1 / spacemacs-keybindings
Created May 19, 2018 02:39 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |