Skip to content

Instantly share code, notes, and snippets.

View tduyng's full-sized avatar
➡️
The next ...

Duy NG tduyng

➡️
The next ...
View GitHub Profile
@tduyng
tduyng / gitenv.md
Created June 5, 2021 07:17 — forked from wojteklu/gitenv.md
Perfect git environment on OS X

Perfect git environment on OS X

Global alias

Add the following to your ~/.bashrc:

alias g='git'

Branch auto-completion

@tduyng
tduyng / readme.md
Last active May 19, 2021 05:47 — forked from ChriRas/readme.md
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
# Postgresql
# -------------------------
version: "3"
services:
app:
env_file:
- .development.env
container_name: awesome_nest_boilerplate
restart: always
build: .

Assets, Webpacker and Rails 6. Why your images and css aren’t showing up.

Rails 6 is full of fun awesome new features and some new ways of compiling our assets. Heroku is one of the easiest way to deploy your rails application but things between development and production can get a little hairy if you’re not careful with a couple of gotchas that exist with the way we compile and use assets in production making your site look weird by having missing pictures or css that just don’t load. Throw in two ways off compiling assets now with Webpacker and Sprockets and things getting even more complicated.

Images in your assets directory

The first thing you need to do with any asset your you want to use like images that are in your assets folder is to use the asset_path helper or asset_url helper instead of a hardcode link to the path.

So image tag that might look like this in your erb file:

CREATE TABLE "posts" (
"id" serial NOT NULL,
"title" character varying(255) NOT NULL UNIQUE,
"body" TEXT NOT NULL,
CONSTRAINT posts_pk PRIMARY KEY ("id")
) WITH (
OIDS=FALSE
);
@tduyng
tduyng / key-binding.json
Last active March 5, 2021 00:27
Config vim in vscode
// Place your key bindings in this file to override the defaultsauto[]
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+k ctrl+u",
"command": "-editor.action.transformToUppercase",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+7",
@tduyng
tduyng / scrapy-tuto.md
Last active February 20, 2024 07:06
Tutorial scrapy in vietnamese

Scrapy

This is source code crawl data vietnamnet paper using Scrapy

Github

  • Hello

1. Đặt vấn đề

1.1. Web crawler

@tduyng
tduyng / express-nginx.md
Last active March 18, 2021 06:51 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

How to configure HTTPS with Lets Encrypt, Nginx reverse proxy, Express and Node

  1. Have a Node app ready for production.
  2. Create an app.js file in your project directory:
const express = require('express');
const path = require('path');
const app = express();

// Allow dotfiles - this is required for verification by Lets Encrypt's certbot
@tduyng
tduyng / webdev_online_resources.md
Created February 27, 2021 08:42 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)