Skip to content

Instantly share code, notes, and snippets.

@mealCode
mealCode / gist:ad0d52ded1fc69eb1c623d082a9bd184
Created August 5, 2021 10:16
Continuous deployment from Github to AWS EC2 using AWS CodeDeploy | Installation
apt-get update
apt-get install -y ruby
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/releases/codedeploy-agent_1.0-1.1597_all.deb
mkdir codedeploy-agent_1.0-1.1597_ubuntu20
dpkg-deb -R codedeploy-agent_1.0-1.1597_all.deb codedeploy-agent_1.0-1.1597_ubuntu20
sed 's/2.0/2.7/' -i ./codedeploy-agent_1.0-1.1597_ubuntu20/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.0-1.1597_ubuntu20
dpkg -i codedeploy-agent_1.0-1.1597_ubuntu20.deb
systemctl start codedeploy-agent
systemctl enable codedeploy-agent
@mealCode
mealCode / gist:43d8184dd1d923176975e1a4f6fe44f3
Created August 4, 2021 07:48
Joi validation error helpers
messages: {
'any.custom': [Object],
'any.default': [Object],
'any.failover': [Object],
'any.invalid': [Object],
'any.only': [Object],
'any.ref': [Object],
'any.required': [Object],
'any.unknown': [Object],
'string.alphanum': [Object],
@mealCode
mealCode / gist:eac0f387a7ca2724757429b56a6a547c
Last active August 3, 2021 04:25
manual token expiration
// expires in 1hr
const d = new Date()
d.setHours(d.getHours() + 1)
const expiration = new Date(d)
if (expiration < new Date()) {
// token expired
}
// .getMinutes() -> if you want to expires in minutes and so on...
@mealCode
mealCode / gist:abedc4fc105e2a3669f5676aa7f02dad
Last active August 1, 2021 05:58
react native no bundle URL present
This problem happens when you not allow unsecure connections via localhost, or maybe you tried to accept unsecure connections via http.
To fix this, add this on `info.plist`:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>