- I need to host 3 websites:
- WHMCS: For my hosting billing
- WordPress 1x: For my blog
- WordPress 1x: For my testing
- 1x AWS EC2 t2.nano for MariaDB
| <?php | |
| /** | |
| * This is my first contribution in stack overflow! | |
| * https://stackoverflow.com/questions/17161114/php-http-build-query-with-two-array-keys-that-are-same/77402243#77402243 | |
| */ | |
| function http_build_query_duplicate_key( array $array ) { | |
| $special_keys = []; | |
| foreach($array as $key => $value) { |
| async (event, steps) => { | |
| // NodeJS implementation in Pipedream of "Intent to Receive" for Xero webhooks | |
| const { createHmac } = await import('crypto'); | |
| const xero_webhook_key = 'OSd0eLlVIY9ZhViEqlDUh4+6n6M+Lo+eDaEJheJ6OCCgWwIz2D3JIAU6jPMipHRbgKTLz2uJ+xiACXGDBLrgdA==' // Get this from the Xero app | |
| const body_string = Buffer.from(steps.trigger.raw_event.body_b64, 'base64').toString() // Use RAW body data so that Pipedream doesn't break our data | |
| const xero_hash = steps.trigger.event.headers["x-xero-signature"] // Could probably shorten, but keeping it long for consistency | |
| let our_hash = createHmac('sha256', xero_webhook_key).update(body_string).digest("base64") // Generate the hash Xero wants | |
| let statusCode = xero_hash == our_hash ? 200 : 401 // If the hashes match, send a 200, else send a 401 |
I'm the bigfan of gorails.com website and I'm using for the past 5 years. It helps me to setup Ruby on Rails locally either on Windows or Ubuntu.
For Vagrant, I'm following this article to setup it with Ruby on Rails: https://gorails.com/guides/using-vagrant-for-rails-development
There is multiple when following those article. Hence, I decided to configure it manually where Vagrant only works as ruby interpreter and PostgreSQL installed on the host operating system.
| <?php | |
| /* | |
| * Get all users registered after $start and before $end (dates in yyyy-mm-dd format) | |
| * | |
| * Based on my answer to this question: http://wordpress.stackexchange.com/questions/51485/how-can-i-query-all-users-who-registered-today/51492#51492 | |
| * | |
| * @param (string) $start - start date in yyyy-mm-dd format | |
| * @param (string) $end - end date in yyyy-mm-dd format | |
| */ | |
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
| #!/usr/bin/env ruby | |
| # List all keys stored in memcache. | |
| # Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
| require 'net/telnet' | |
| headings = %w(id expires bytes cache_key) | |
| rows = [] |
| require 'socket' | |
| # 1. Create | |
| # AF_INET means IPv4 (xxx.xxx.xxx.xxx) | |
| # SOCK_STREAM means communicating with a stream (TCP) | |
| # | |
| # Can be simplified to symbols :INET and :STREAM, respectively | |
| server = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM) |
| openssl pkcs7 -print_certs -in old.p7b -out new.crt | |
| # openssl pkcs7 -print_certs -in old.p7b -out new.cer |
Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.
When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:
ProxyCommand nc -x localhost:1080 %h %p