Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
#!/bin/bash | |
# mytop.sh - (Monitor mysql process list with top like screen updates and adiditonal stats like cpu/io usage) | |
# | |
# Sample Output: | |
# | |
# CPU Usage 3.29% user 1.60% system 3.37% io wait 0.00% steal 91.59% idle | |
# Up 17 days 10 hours Load Avg 0.43 0.36 0.35 Processes 1(running) 408(total) Last PID 17825 | |
# +----------+------+-----------+----+---------+------+-------+------------------+ | |
# | Id | User | Host | db | Command | Time | State | Info | | |
# +----------+------+-----------+----+---------+------+-------+------------------+ |
'use strict'; | |
const AWS = require("aws-sdk"); | |
const dynamodb = new AWS.DynamoDB(); | |
const querystring = require("querystring"); | |
const http = require("https"); | |
const TWITTER_API_URL = "https://api.twitter.com" | |
const TWITTER_HOSTNAME = "api.twitter.com" | |
/** |
FROM ubuntu:16.04 | |
MAINTAINER Ben Hardill <[email protected]> | |
ENV DEBIAN_FRONTEND noninteractive | |
USER root | |
RUN apt-get update && apt-get install -y \ | |
pkg-config \ |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
#include "FastLED.h" | |
// FastLED "100-lines-of-code" demo reel, showing just a few | |
// of the kinds of animation patterns you can quickly and easily | |
// compose using FastLED. | |
// | |
// This example also shows one easy way to define multiple | |
// animations patterns and have them automatically rotate. | |
// | |
// -Mark Kriegsman, December 2014 |
<?php | |
/** | |
* Command for losslessly compressing Amazon AWS images | |
*/ | |
use Illuminate\Console\Command; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Input\InputArgument; | |
/** |
<?php | |
function compose(callable $initial, callable ...$functions) | |
{ | |
if (count($functions) < 1) { | |
throw new \InvalidArgumentException('at least two functions are required'); | |
} | |
return array_reduce($functions, function ($f, $g) { | |
return function (...$args) use ($f, $g) { | |
return $f($g(...$args)); |
<?php | |
require 'vendor/autoload.php'; | |
function decrypt($secret, $string) | |
{ | |
try { | |
Firebase\JWT\JWT::$leeway = 1; // $leeway in seconds is a clock skew times between the signing and verifying servers | |
$string = base64_decode($string); | |
return (array) Firebase\JWT\JWT::decode( | |
openssl_decrypt( |
<?php | |
/** | |
* Move image inside <p> tag above the <p> tag while preserving any link around image. | |
* Can be prevented by adding any attribute or whitespace to <p> tag, e.g. <p class="yolo"> or even <p > | |
*/ | |
function remove_p_around_img($content) | |
{ | |
$contentWithFixedPTags = preg_replace_callback('/<p>((?:.(?!p>))*?)(<a[^>]*>)?\s*(<img[^>]+>)(<\/a>)?(.*?)<\/p>/is', function($matches) { | |
$image = $matches[2] . $matches[3] . $matches[4]; |
<?php | |
print '<pre>'; | |
class parserXPath extends DOMXPath { | |
private function getPage($url){ | |
$ch = curl_init(); | |
curl_setopt ($ch , CURLOPT_URL , $url); | |
curl_setopt ($ch , CURLOPT_USERAGENT , "Mozilla/5.0"); | |
curl_setopt ($ch , CURLOPT_RETURNTRANSFER , 1 ); | |
// можете добавить кучу других опций |