Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -x
function setenv-all-pods() {
echo
DEPLOYMENT_LIST=$(kubectl -n $1 get deployment -o jsonpath='{.items[*].metadata.name}')
echo "Set Log4J setting for all pods by overriding LOG4J_FORMAT_MSG_NO_LOOKUPS with true."
for deployment_name in $DEPLOYMENT_LIST; do
kubectl -n $1 set env deployment $deployment_name LOG4J_FORMAT_MSG_NO_LOOKUPS="true"
done
@ircmaxell
ircmaxell / php_zpp.php
Last active March 1, 2023 23:48
Zend Parse Parameters. In PHP
<?php
namespace ZPP;
const IS_STRING = "string";
const IS_BOOL = "boolean";
const IS_LONG = "integer";
const IS_DOUBLE = "double";
const IS_ARRAY = "array";
const IS_OBJECT = "object";
@datibbaw
datibbaw / pubsub.js
Last active December 17, 2015 08:49
(function(ns) {
ns.PubSub = function() {
// private variables
var events = {},
expando = 'ps' + ("" + Math.random()).substr(2),
guid = 0;
// private functions
function newq(event)
@andreiz
andreiz / classifier.php
Last active July 12, 2022 12:50
A simple example of logistic regression via gradient descent in PHP.
<?php
error_reporting(E_ALL);
define('NUM_FEATURES', 3);
// My dataset describes cities around the world where I might consider living.
// Each sample (city) consists of 3 features:
// * Feature 1: average low winter temperature in the city
// * Feature 2: city population, in millions
@srsbiz
srsbiz / hexit.php
Last active December 1, 2022 04:59
Web hex dumper, with colors
<?php
header('Content-Type: text/html; charset=utf-8');
define('POST_MAX_LENGTH', 4096);
if (!isset($_POST['txt'])) {
$txt = "<?php\necho 'Hello World!';\n?>";
} elseif(strlen($_POST['txt']) > POST_MAX_LENGTH) {
$txt = substr($_POST['txt'], 0, POST_MAX_LENGTH);
} else {
$txt = $_POST['txt'];
@hakre
hakre / bopypad.md
Last active October 5, 2015 07:07
SO copypad

This question appears to be off-topic because it is about ...

Tutoring with a software named Wordpress, here a Tutorial for Extending it with a specific Plugin and an individual Theme.

Tutoring a Software Product named Magento.

a very individual problem without given any further reference to commons in programming in a useful manner. See also: Stack Overflow question checklist

a Debugging request of larger chunks of non-isolated code that may (or may not) contain the code the question asks about. Instead the code should be reduced the a bare minimum example code that outlines the problem and question in a compact and self-explaining manner.

@Integralist
Integralist / remote-git.md
Created February 21, 2012 09:51
Basic set-up of remote git repository on a standard server

Set-up remote git repository on a standard server

The first thing to do is to install Git on the remote server.

Once you do that the rest of the process is split into three sections:

  1. Server set-up
  2. Local set-up (push commits)
  3. Server (pull commits)
@gooh
gooh / xpath_match_all
Last active September 28, 2015 00:48
function for people whining that preg_match_all is less to type and concluding from it that regex must be better for parsing html than a dom parser
<?php
/**
* Run an XPath query against an HTML string and returns the results
*
* @param string $xpath The XPath query to run on $thml
* @param string $html The HTML to parse. Uses the previously used string if omitted
* @return array
*/
function xpath_match_all($query, $html = '')
{