Skip to content

Instantly share code, notes, and snippets.

View janpapenbrock's full-sized avatar

Jan Papenbrock janpapenbrock

View GitHub Profile
@janpapenbrock
janpapenbrock / album.service.ts
Created June 11, 2021 06:33 — forked from ikismail/album.service.ts
Retry failed HTTP requests in Angular | Immediate retry, delayed retry and retry with backoff
/**
* 1. Immediate retry
* 2. delayed retry
* 3. retry with backoff
*/
import { Injectable } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import { EMPTY, Observable, of, throwError } from "rxjs";
import {
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@janpapenbrock
janpapenbrock / trigger-jenkins-job.sh
Last active July 27, 2021 14:45
Trigger Jenkins job from Bash script, works with multi branch pipeline
#!/bin/bash -e
## Configuration
JENKINS="https://my-jenkins.localhost"
JENKINS_USER="user_name_here"
JENKINS_USER_TOKEN="api_token_here"
# nested path to job
@janpapenbrock
janpapenbrock / graphite-dashboard-tool.sh
Created January 4, 2017 12:55 — forked from toni-moreno/graphite-dashboard-tool.sh
A shell script to help export/import json formatted graph and dashboards from a Graphite mysql database.
#!/bin/bash
# (c) Toni Moreno
# tool to import / export graphs and dashboards to mysql db
# NOTE: be sure you have granted FILE privileges
# if apparmor is configured you should add to
# /etc/apparmor.d/usr.sbin.mysqld
# /tmp/* rw,
LOCAL_SETINGS="/opt/graphite/webapp/graphite/local_settings.py"
@janpapenbrock
janpapenbrock / install.sh
Created January 7, 2016 13:38
Xhprof to flamegraph
#!/bin/bash
INSTALL_DIR="~/third-party/"
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"
git clone https://github.com/brendangregg/FlameGraph
sudo ln -s "$INSTALL_DIR"/FlameGraph/flamegraph.pl /usr/local/bin/flamegraph.pl
@janpapenbrock
janpapenbrock / create_hash.php
Created November 27, 2015 09:23
Magento Create Admin User Password Hash
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once (MAGENTO . '/app/Mage.php');
Mage::app();
$password = 'super-secret';
$hash = Mage::helper('core')->getHash($password, Mage_Admin_Model_User::HASH_SALT_LENGTH);
#!/bin/sh
set -e
set -x
LOG_DIR=$HOME/graphite-volumes/var-log
DATA_DIR=$HOME/graphite-volumes/graphite-storage
VOLUMES_INIT_CONTAINER_NAME=graphite-volumes-init
# Send a metric to statsd from bash
#
# Useful for:
# deploy scripts (http://codeascraft.etsy.com/2010/12/08/track-every-release/)
# init scripts
# sending metrics via crontab one-liners
# sprinkling in existing bash scripts.
#
# netcat options:
# -w timeout If a connection and stdin are idle for more than timeout seconds, then the connection is silently closed.
@janpapenbrock
janpapenbrock / profiling-controller.php
Created December 18, 2014 13:16
Magento Controller only displaying profiling information of Magento initialization
public function indexAction()
{
$html = $this->getLayout()
->createBlock('core/profiler')
->toHtml();
$this->getResponse()->setBody($html);
}
@echo off
setlocal enabledelayedexpansion
REM
REM PngOutBatch
REM
REM Nic Jansma - nic@nicj.net
REM
REM Runs a PNG through PngOut multiple times at different block sizes. Shows the
REM file-size savings during and at the end.