Skip to content

Instantly share code, notes, and snippets.

@hieu-v
hieu-v / Postgresql.md
Created November 21, 2019 09:09
Some useful commands
sudo -i -u postgres
createuser --interactive --pwprompt
createdb -O user dbname
GRANT permissions ON DATABASE dbname TO username;
dropdb ...
dropuser ...

psql -d database_name -1 -f database_name.bak
@hieu-v
hieu-v / regex-japanese.txt
Created November 27, 2019 07:16 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@hieu-v
hieu-v / JapaneseRegex.js
Created November 27, 2019 07:17 — forked from ryanmcgrath/JapaneseRegex.js
Regex to test for presence of Japanese characters
// REFERENCE UNICODE TABLES:
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
// http://www.tamasoft.co.jp/en/general-info/unicode.html
//
// TEST EDITOR:
// http://www.gethifi.com/tools/regex
//
// UNICODE RANGE : DESCRIPTION
//
// 3000-303F : punctuation
@hieu-v
hieu-v / bitdefender.md
Last active February 26, 2024 09:39
Bitdefender
url = 'http://data.linz.gv.at/katalog/population/abstammung/2012/auslg_2012.csv'
content = Net::HTTP.get_response(URI.parse(url)).body
{x: content}.to_json
{
"data": [
{
"id": "7",
"type": "deck",
"attributes": {
"id": 7,
"name": "aaa",
"description": "aaa",
"user_id": 5,
cd /opt/bitnami/
sudo ./use_redmine

cd /opt/bitnami/apps/redmine/htdocs/plugins

cd /opt/bitnami/apps/redmine/htdocs/
bundle install --without development test postgresql sqlite --no-deployment
bundle install --without development test postgresql sqlite --deployment
@hieu-v
hieu-v / devise.md
Last active March 22, 2020 08:10
Gem Devise tips

Change email without confirmation

@user = User.find_by_email('bob@site.com')
@user.email = 'dead@site.com'
@user.skip_reconfirmation!
@user.save!

Require password_confirmation when create new user

@hieu-v
hieu-v / docker-compose.yml
Created April 22, 2020 10:38 — forked from seanhandley/docker-compose.yml
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@hieu-v
hieu-v / fix-vagrant.md
Created May 22, 2020 07:11
Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faul…

Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module. Please verify that these guest additions are properly installed in the guest. This is not a bug in Vagrant and is usually caused by a faulty Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was: