Skip to content

Instantly share code, notes, and snippets.

View quyen91's full-sized avatar
🌴
On vacation

quyencv quyen91

🌴
On vacation
View GitHub Profile
@quyen91
quyen91 / m3u8-to-mp4.md
Created February 16, 2024 02:17 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@quyen91
quyen91 / read-access.sql
Created March 22, 2022 03:55 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@quyen91
quyen91 / last_day_of_month.go
Created March 12, 2020 17:54 — forked from hosszukalman/last_day_of_month.go
Get the last day of the actual month in Golang
package main
import (
"fmt"
"time"
)
func main() {
now := time.Now()
@quyen91
quyen91 / slug.js
Created August 16, 2019 02:01 — forked from bluzky/slug.js
Remove vietnamese accent javascript / Bỏ dấu tiếng Việt
function stringToSlug(str) {
// remove accents
var from = "àáãảạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệđùúủũụưừứửữựòóỏõọôồốổỗộơờớởỡợìíỉĩịäëïîöüûñç",
to = "aaaaaaaaaaaaaaaaaeeeeeeeeeeeduuuuuuuuuuuoooooooooooooooooiiiiiaeiiouunc";
for (var i=0, l=from.length ; i < l ; i++) {
str = str.replace(RegExp(from[i], "gi"), to[i]);
}
str = str.toLowerCase()
.trim()
@quyen91
quyen91 / gist:43b08724284063c90dc1e54fbbc37d50
Created April 21, 2019 08:48 — forked from jendiamond/gist:6128723
Creating your own Gem & Command Line Interface Using Bundler

Presentation slides

Create a Gem - Make it a CLI - Add Rspec Tests

Create a Gem - Make it a Command Line Interface - Add Rspec Tests Using Bundler & Thor

#Creating your own Gem

  1. Run this command in your Terminal. This creates and names all the files you need for your gem. We are going to create a Lorem Ipsum Generator; you can call it whatever you want but seeing as we are creating a Lorem Ipsum generator we'll call it lorem. Read about gem naming conventions.
@quyen91
quyen91 / deploy.yml
Created April 1, 2019 17:07 — forked from caalberts/deploy.yml
Ansible Playbook to Deploy Rails to AWS
---
# Deploy rails app from localhost to remote servers
- name: Set up AWS infrastructure
hosts: localhost
connection: local
roles:
- setup_aws
- name: Package app
@quyen91
quyen91 / .gitignore
Created September 30, 2018 04:21 — forked from WattsInABox/.gitignore
Generate Static HTML Website Using Ruby on Rails
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors)
/out
@quyen91
quyen91 / create_files.rb
Created September 30, 2018 04:15 — forked from mindreframer/create_files.rb
Benchmark Static Site Generators
#!/usr/bin/env ruby -wKU
require 'yaml'
class Generator
def run
300.times do |i|
File.open(name(i), 'w') do |f|
f.puts Article.new.content
end
end
@quyen91
quyen91 / Mutltiple_SSH.md
Created September 29, 2018 02:45 — forked from hkasera/Mutltiple_SSH.md
How to use multiple github accounts?

I have two accounts on github, one is personal account and other is office account. I typically face this problem to manage pushing to different repos using these different accounts.

I found a great way of doing it without any hassle.

Step 1 : Generate different ssh keys for both the accounts

Suppose my personal id is jane@gmail.com and office account is jane@doe.com

Follow the steps mentioned here to generate ssh keys : https://help.github.com/articles/generating-ssh-keys/