This is just stuff that I have put down that I find I use a lot of the time for my own reference.
$ git pull
public static function insertOrUpdate($table, array $rows) | |
{ | |
$first = reset($rows); | |
$columns = implode(',', array_map(function($value) | |
{ | |
return "$value"; | |
}, array_keys($first))); | |
$values = implode(',', array_map(function($row) |
Displays contents of /proc/net files. It works with the Linux Network Subsystem, it will tell you what the status of ports are ie. open, closed, waiting, masquerade connections. It will also display various other things. It has many different options. Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.
Sample output:
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 127.0.0.1.62132 127.0.0.1.http ESTABLISHED
#!/bin/bash | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
apt-get install pkg-config libmagickwand-dev -y | |
cd /tmp | |
wget https://pecl.php.net/get/imagick-3.4.0.tgz | |
tar xvzf imagick-3.4.0.tgz |
#Laravel 5 Simple ACL manager
Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.
If the user has a 'Root' role, then they can perform any actions.
Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
# less to scss based on http://stackoverflow.com/a/19167099/2363935 | |
namespace :convert do | |
task :less_to_scss do | |
source_glob = "assets/less/*.less" | |
dest_dir = "converted" | |
rm_r dest_dir rescue nil | |
mkdir_p(dest_dir) |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>PHP INFO</title> | |
<style type="text/css"> | |
body {font-family: "Ubuntu Mono", "Monospace", "Monaco", "Courier New"; font-size: 12px} | |
</style> | |
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" /> | |
</head> | |
<body> |