Skip to content

Instantly share code, notes, and snippets.

@dawn360
dawn360 / eoorf
Created October 28, 2022 15:28
Simulator Commands #ios #testing
xcrun simctl --help
# To create a new simulator, run the following command
xcrun simctl create “my first simulator” “iPhone X” com.apple.CoreSimulator.SimRuntime.iOS-14–5
xcrun simctl boot 64B94C27-A5BB-4B2A-8E6B-C48B1AFEF298
# inspect the content of a plist file using -p option.
plutil -p "[HOME]/Library/Developer/CoreSimulator/Devices/[DEVICE_NAME]/data/Library/Preferences/.GlobalPreferences.plist"
plutil -replace AppleLocale -string "en_AU" ”$HOME/Library/Developer/CoreSimulator/Devices/64B94C27-A5BB-4B2A-8E6B-C48B1AFEF298/data/Library/Preferences/.GlobalPreferences.plist
@dawn360
dawn360 / vue libs
Created March 7, 2019 19:42
vue libs
datatables.net
.extract([
'lodash', 'jquery', 'vue', 'query-string',
'datatables.net', 'datatables.net-buttons', 'datatables.net-bs4', 'datatables.net-buttons-bs4', 'datatables.net-buttons/js/buttons.html5.js',
'select2', 'axios', 'moment', 'popper.js', 'bootstrap', 'vue-chartjs', 'v-tooltip', 'moment/locale/es', 'vue-moment',
'jszip/dist/jszip', 'pdfmake/build/pdfmake.js', 'pdfmake/build/vfs_fonts.js', 'sweetalert', 'vue-strap', 'vue-strap/dist/vue-strap-lang',
'moment-array-dates', 'vue-toast', 'randomcolor', 'url', 'google-maps'
])
@dawn360
dawn360 / kube
Created December 5, 2018 19:03
Kubenetes on AWS
https://ramhiser.com/post/2018-05-20-setting-up-a-kubernetes-cluster-on-aws-in-5-minutes/
https://aws.amazon.com/blogs/aws/amazon-elastic-container-service-for-kubernetes/
https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-guestbook
https://kubernetes.io/docs/setup/turnkey/aws/
https://medium.com/containermind/how-to-create-a-kubernetes-cluster-on-aws-in-few-minutes-89dda10354f4
https://www.weave.works/technologies/kubernetes-on-aws/
https://kubernetes.io/docs/tutorials/online-training/overview/
https://www.udacity.com/course/scalable-microservices-with-kubernetes--ud615
@dawn360
dawn360 / ebs_monut.sh
Created November 28, 2018 19:31
Mount EBS to EC2
#list the disk you attached to your instance.
lsblk
#Check if the volume has any data using the following command.
sudo file -s /dev/xvdf
#Format the volume to ext4 filesystem using the following command.
sudo mkfs -t ext4 /dev/xvdf
#Create a directory of your choice to mount our new ext4 volume. I am using the name “newvolume”
sudo mkdir /newvolume
#Mount the volume to “newvolume” directory using the following command.
sudo mount /dev/xvdf /newvolume/
@dawn360
dawn360 / laravelsnippets.sh
Last active December 17, 2018 20:46
Laravel Commands
php artisan make:controller -r -m=Post
AWS Composer update issue
https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-
https://github.com/composer/composer/issues/4247
run on deploy
php artisan config:cache
https://github.com/alexeymezenin/laravel-best-practices
@dawn360
dawn360 / trax_locks.sql
Last active November 6, 2018 14:09
MySQL Transaction Locks
select * from INFORMATION_SCHEMA.INNODB_TRX;
select * from INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT CONCAT('KILL ', trx.trx_mysql_thread_id) kill_statement, trx.trx_mysql_thread_id thd_id, ps.user, ps.host, trx.trx_query FROM INFORMATION_SCHEMA.INNODB_TRX trx JOIN INFORMATION_SCHEMA.PROCESSLIST ps ON trx.trx_mysql_thread_id = ps.id WHERE user != 'system_user';
KILL 17333;
-- http://www.markleith.co.uk/2011/05/31/finding-and-killing-long-running-innodb-transactions-with-events/
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_run_supervised_celeryd.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
# Get django environment variables
celeryenv=`cat /opt/python/current/env | tr '\n' ',' | sed 's/export //g' | sed 's/%/%%/g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`
celeryenv=${celeryenv%?}
@dawn360
dawn360 / xmlrpctimeout.py
Last active February 23, 2017 17:16
xmlrpc set timeout with custom transport
import http.client
import xmlrpc.client
class TimedTransport(xmlrpc.client.Transport):
timeout = 30
def set_timeout(self, timeout):
self.timeout = timeout
PIP Upgrade all
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
#Publish
import json
import boto3
message = {"foo": "bar"}
client = boto3.client('sns')
response = client.publish(
TargetArn=arn,
Message=json.dumps({'default': json.dumps(message)}),