Skip to content

Instantly share code, notes, and snippets.

View huobazi's full-sized avatar
🎯
Focusing

Marble Wu huobazi

🎯
Focusing
View GitHub Profile
@huobazi
huobazi / a.md
Last active September 6, 2019 03:12
flutter 真机调试无法连接到 iphone
 flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.4 18E226, locale en-CN)
⣻ideviceinfo returned an error:
ERROR: Could not connect to lockdownd, error code -21

解决办法

@huobazi
huobazi / server.md
Created February 27, 2019 00:53 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.

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 February 21, 2019 02:32 — forked from Epigene/deploy.rb
Mina deployment file for rails applications
# 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]]'

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 December 15, 2018 08:17
error full trace of devise and action-store and attr-json
[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 November 22, 2018 10:54
Address already in use - bind(2) (Errno::EADDRINUSE)
lsof -wni tcp:3000 

or

ps aux | grep puma

the

kill -9 THE-PID
@huobazi
huobazi / makecerts.sh
Created November 20, 2017 01:33 — forked from rgstephens/makecerts.sh
Make Self Signed Certificate
#!/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 November 20, 2017 01:33
Be your own Certificate Authority
# 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
@huobazi
huobazi / generate_local_certificate.sh
Created November 20, 2017 01:32 — forked from adiog/generate_local_certificate.sh
Generate local certificate
#!/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
@huobazi
huobazi / install-node.sh
Created November 5, 2017 02:11 — forked from ttonyh/install-node.sh
Install Node
#!/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:";