Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

M#3 zspine

🎯
Focusing
View GitHub Profile
View ubuntu.sh
#restart
sudo reboot
#shutdown
sudo poweroff
#copy from local to remote server
#scp target file user@ip-address destination
scp /home/migration/backup/example.txt root@1.1.1.1:/var/www/vhosts/example.com/backup
@zspine
zspine / codeception-commands.md
Last active Aug 1, 2018
Codeception Console Commands
View codeception-commands.md

Run Tests

php bin/codecept run
php bin/codecept run unit
php bin/codecept run acceptance
php bin/codecept run functional

Acceptance Test with PhantomJs

View bootstrap-row-loop.php
<div class="row">
<?
$i = 0;
foreach ($cars as $car) {
?>
Your code here
<?
$i++;
if ($i % 3 == 0) {
echo '</div><div class="row">';
@zspine
zspine / Vagrantfile
Created Nov 20, 2017
Ubuntu, Setting up a docker development env with Vagrant
View Vagrantfile
$script = <<SCRIPT
# Set up the repository
echo “Update the apt package index...”
sudo apt-get update -y
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
View deliver_sm.py
"""Convert submit_sm to deliver_sm and reinject it back in rabbitmq
as coming from connector's CID same as submit_sm's uid
Design is diagrammed here: https://sketchboard.me/nAvXcoQqcbIt#/"""
import cPickle as pickle
import logging
import uuid
import pika
from datetime import datetime
View deliver_sm_thrower.py
from twisted.internet import defer, reactor
from jasmin.vendor.smpp.pdu.operations import DeliverSM
from jasmin.queues.configs import AmqpConfig
from jasmin.queues.factory import AmqpFactory
from jasmin.routing.jasminApi import SmppServerSystemIdConnector
from jasmin.routing.content import RoutedDeliverSmContent
from jasmin.queues.test.test_amqp import waitFor
@defer.inlineCallbacks
def connect_and_publish(pdu, dc):
@zspine
zspine / rabbitmq-ubuntu-16.04.sh
Created Apr 29, 2019
Quick Install RabbitMQ Server on Ubuntu 16.04
View rabbitmq-ubuntu-16.04.sh
sudo apt-get update
sudo apt-get upgrade
#Instruct apt to trust packages signed by rabbitmq signing key
wget -O - "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" | sudo apt-key add -
#Enable apt HTTPS Transport
sudo apt-get install apt-transport-https
#Add the apt repository to the source list directory
@zspine
zspine / SuperAdminGroupContextBuilder.php
Last active Sep 23, 2019
API Platform custom ContextBuilder and Denormalizer
View SuperAdminGroupContextBuilder.php
<?php
namespace App\Serializer\ApiPlatform;
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use App\Entity\User;
@zspine
zspine / Account.php
Created Sep 25, 2019
Symfony User Management
View Account.php
<?php
namespace App\Entity;
use App\Model\Account\MembershipInterface;
use App\Model\Resource\TimestampableTrait;
use App\Model\Resource\ToggleableTrait;
use App\Model\Resource\UuidTrait;
use App\Model\User\UserInterface;
use Doctrine\Common\Collections\Collection;
@zspine
zspine / .env
Created Oct 4, 2019
API Platform json_login with separate domain SPA
View .env
APP_COOKIE_DOMAIN=.example.test
CORS_ALLOW_ORIGIN=^https?://app.example.test(:[0-9]+)?$