Skip to content

Instantly share code, notes, and snippets.

View CodeXSky's full-sized avatar
🏠
Working from home

Le Song Hung CodeXSky

🏠
Working from home
View GitHub Profile
@CodeXSky
CodeXSky / Create Rabbitmq Admin and Create queue
Last active November 21, 2024 13:00
Create Rabbitmq Admin and Queue
1. Create account admin
sudo rabbitmqctl add_user test test
sudo rabbitmqctl set_user_tags test administrator
sudo rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
2. Declare Queue
sudo rabbitmqadmin declare queue name=my-new-queue durable=true
3. Publish message to queue
sudo rabbitmqadmin publish routing_key="queue" payload="hello, world"
@CodeXSky
CodeXSky / gist:56acc6f7cb9c5fdf06dd9516a43cdbed
Created May 17, 2018 06:41
Add rabbitmqadmin on ubuntu
#/bin/bash
# these action should be run with sudo level
# activate management plugin first
rabbitmq-plugins enable rabbitmq_management
# restart the rabbitmq-server
service rabbitmq-server restart
# download the rabbitmqadmin script locally
const bip39 = require("bip39");
const bip32 = require("ripple-bip32");
const ripple = require('ripplelib')
const sign = require('ripple-sign-keypairs')
var mnemonic = 'novel matter final only nice cheese address cradle civil crash great flame struggle consider crowd surface purpose saddle mango endless mixed trial tape wrap'
// Or generate:
// mnemonic = bip39.generateMnemonic()
console.log('mnemonic: ' + mnemonic)
@CodeXSky
CodeXSky / install virtualenv ubuntu 16.04.md
Created June 26, 2020 06:24 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@CodeXSky
CodeXSky / rm_mysql.md
Created August 31, 2020 14:43 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@CodeXSky
CodeXSky / youtubeID.rb
Created September 3, 2020 16:47 — forked from eduardinni/youtubeID.rb
Get YouTube ID from various YouTube URL using Ruby
# Get YouTube ID from various YouTube URL
# Ruby port from JavaScript version: https://gist.github.com/takien/4077195/
def get_youtube_id(url)
id = ''
url = url.gsub(/(>|<)/i,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/)
if url[2] != nil
id = url[2].split(/[^0-9a-z_\-]/i)
id = id[0];
else
@CodeXSky
CodeXSky / video_embed_url_generator.rb
Created September 3, 2020 17:17 — forked from md-farhan-memon/video_embed_url_generator.rb
Ruby/Rails generate YouTube or Vimeo embed video ifram from url
class VideoEmbedUrlGenerator
REGEX_ID = %r{(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/|vimeo\.com\/)([a-zA-Z0-9_-]{8,11})}.freeze
REGEX_PROVIDER = /(youtube|youtu\.be|vimeo)/.freeze
def initialize(url)
@url = url
end
def construct_iframe
'<iframe '\
@CodeXSky
CodeXSky / mac-setup-redis.md
Created September 7, 2020 03:33 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@CodeXSky
CodeXSky / ngrok-installation.md
Created September 23, 2020 02:57 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

Installing ngrok on OSX

brew cask install ngrok

Using ngrok

The easiest way to use ngrok to tunnel into your localhost is if your local project is running on a specific port (e.g. not using named vhosts). You just run ngrok http [port number].

You can quickly boot up a local webserver using ruby. cd into the project's root directory and run ruby -run -e httpd . -p [port number].