Skip to content

Instantly share code, notes, and snippets.

Marble Wu huobazi

Block or report user

Report or block huobazi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@huobazi
huobazi / server.md
Created Feb 27, 2019 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.
View server.md

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@huobazi
huobazi / deploy.rb
Created Feb 21, 2019 — forked from Epigene/deploy.rb
Mina deployment file for rails applications
View deploy.rb
# Mina Deploy
# ===========
#
# Adapted from Creative deploy stack in Manabalss v4, Mar.2015, updated to support staging on Jun.2015
# On first deploy do: mina setup --verbose
# Then do : mina deploy[initialize] --trace
#
# Usage examples:
# mina deploy[soft,seed,compile] to=staging # deploy task with all options | a simple `mina deploy` will deploy to production
# mina rake[db:seed] # for multi-argument tasks # mina 'rake[payments:refund[arg1\,arg2]]'
View output.markdown

output of an acts-as-taggable-array-on bug with rspec

┌[mw82☮Marble-MacBook-Pro.local]-(~/projects/acts-as-taggable-array-on)-[git://master ✗]-
└> rspec
...FFF.....FF.FFFFFDEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "tag, count(*) as count". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql(). (called from block (2 levels) in acts_as_taggable_array_on at /Users/mw82/projects/acts-as-taggable-array-on/lib/acts-as-taggable-array-on/taggable.rb:33)
FDEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "tag, count(*) as count". 
@huobazi
huobazi / bundle exec rake assets:precompile --trace.md
Last active Dec 15, 2018
error full trace of devise and action-store and attr-json
View bundle exec rake assets:precompile --trace.md
[mw82☮Marble-MacBook-Pro.local]-(~/projects/hello-bug)-[git://master ✗]-
└> bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
PG::ConnectionBad: could not translate host name "none" to address: nodename nor servname provided, or not known
@huobazi
huobazi / Address already in use - bind(2) (Errno::EADDRINUSE).md
Last active Nov 22, 2018
Address already in use - bind(2) (Errno::EADDRINUSE)
View Address already in use - bind(2) (Errno::EADDRINUSE).md
lsof -wni tcp:3000 

or

ps aux | grep puma

the

kill -9 THE-PID
@huobazi
huobazi / makecerts.sh
Created Nov 20, 2017 — forked from rgstephens/makecerts.sh
Make Self Signed Certificate
View makecerts.sh
#!/bin/bash
# https://stackoverflow.com/questions/19665863/how-do-i-use-a-self-signed-certificate-for-a-https-node-js-server
FQDN=$1
KEYDIR=keys
# make directories to work from
#mkdir -p server/ client/ all/
mkdir -p $KEYDIR
# Create your very own Root Certificate Authority
@huobazi
huobazi / self-CA.sh
Created Nov 20, 2017
Be your own Certificate Authority
View self-CA.sh
# Kudos to https://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# Create the Root Key
# The first step is to create the private root key which only takes one step.
# In the example below, I’m creating a 2048 bit key:
openssl genrsa -out rootCA-key.pem 2048
# The next step is to self-sign this certificate.
openssl req -x509 -new -nodes -key rootCA-key.pem -sha256 -days 1024 -out rootCA-cert.pem
View generate_local_certificate.sh
#!/usr/bin/env bash
SERVER=$1
OUTPUT=$2
#Overview
# The following is an extremely simplified view of how SSL is implemented and what part the certificate plays in the entire process.
# Normal web traffic is sent unencrypted over the Internet. That is, anyone with access to the right tools can snoop all of that traffic. Obviously, this can lead to problems, especially where security and privacy is necessary, such as in credit card data and bank transactions. The Secure Socket Layer is used to encrypt the data stream between the web server and the web client (the browser).
# SSL makes use of what is known as asymmetric cryptography, commonly referred to as public key cryptography (PKI). With public key cryptography, two keys are created, one public, one private. Anything encrypted with either key can only be decrypted with its corresponding key. Thus if a message or data stream were encrypted with the server's private key, it can be decrypted only using its corresponding public key, ensuring that the
View install-node.sh
#!/bin/bash
# *** RUN AS ROOT ***
# Define help function
function help(){
echo "Node JS Install Script - Install Node JS";
echo "Usage example:";
echo "install-node (-v|--version) string [(-f|--force)] [(-p|--platform) string] [(-a|--arch) string]";
echo "Options:";
View install-golang.sh
# install golang
GOREL=go1.7.3.linux-amd64.tar.gz
wget https://storage.googleapis.com/golang/$GOREL
tar xfz $GOREL
mv go /usr/local/go
rm -f $GOREL
PATH=$PATH:/usr/local/go/bin
echo 'PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
You can’t perform that action at this time.