Skip to content

Instantly share code, notes, and snippets.

View janpapenbrock's full-sized avatar

Jan Papenbrock janpapenbrock

View GitHub Profile
@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 / 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 / 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 / git-tools.md
Last active December 18, 2015 03:48
Useful git commands
<?php
// Init framework
require 'app/Mage.php';
Mage::app();
// Factory methods to search for
$methods = array(
'Mage::helper',
'Mage::getModel',
'Mage::getResourceModel',
@janpapenbrock
janpapenbrock / mage_ifconfig.xml
Last active December 15, 2015 20:19
Magento XML: ifconfig example from ajaxsearch
<reference name="left">
<block type="core/template" name="left.search" as="leftSearch" before="-">
<action method="setTemplate" ifconfig="ajax_search/general/enabled"><template>ajaxsearch/leftsearch.phtml</template></action>
</block>
</reference>
@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