Skip to content

Instantly share code, notes, and snippets.

@mrfyda
mrfyda / create-jira-components-github.sh
Created March 17, 2023 09:54
Adding GitHub repositories as Jira Components programmatically
#!/bin/bash
GITHUB_AUTH_TOKEN="<your GitHub personal access token>"
GITHUB_ORG_NAME="<your GitHub organization name>"
JIRA_SITE="<your Jira site URL>" # example: https://company.atlassian.net
JIRA_USERNAME="<your Jira user email>" # example: bots+jira@company.com
JIRA_PROJECT="<your Jira project key>" # example: PUL
# API token will be requested when executing. You can get one from https://id.atlassian.com/manage-profile/security/api-tokens
printf "Obtaining all repositories in the $GITHUB_ORG_NAME organization\n"
{
"Issue": {
"tool": {
"name": "credo",
"version": "1.0.0",
"description": "[Credo](http://credo-ci.org/) is a static code analysis tool for the Elixir language with a focus on code consistency and teaching. It implements [its own style guide](https://github.com/rrrene/elixir-style-guide)."
},
"pattern": {
"patternId": "Credo_readability_module_doc",
"parameters": [], // we don't need this, analysis is done client side

Keybase proof

I hereby claim:

  • I am mrfyda on github.
  • I am mrfyda (https://keybase.io/mrfyda) on keybase.
  • I have a public key whose fingerprint is 3866 F2B0 83A0 5F8C 8BC2 A452 5C9F 51CF 6EE9 CF11

To claim this, I am signing this object:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"definitions": {
"service": {
@mrfyda
mrfyda / number-of-open-files.sh
Created August 4, 2015 19:13
Show open file descriptors for Java processes
for pid in `pidof java`; do echo "$(< /proc/$pid/cmdline)"; egrep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$pid/fd | wc -l)"; echo; done
Currency.values.find(_.toString == "USD") // Returns an Option. Deal with it!
@mrfyda
mrfyda / withName.scala
Last active August 29, 2015 14:21
withName hurts...
object Currency extends Enumeration {
val GBP = Value
val EUR = Value
}
Currency.withName("USD") // Boom!
@mrfyda
mrfyda / sbt-codacy-coverage-uploader-java6.sh
Last active August 30, 2019 15:29
sbt-codacy-coverage uploader for Java 6
#!/bin/sh
function coverageFilePath { echo "target/scala-$1/coverage-report/codacy-coverage.json"; }
PROJECT_TOKEN=${CODACY_PROJECT_TOKEN}
if [ -z "${PROJECT_TOKEN}" ]; then
echo "Project token not found."
exit 1
fi
@mrfyda
mrfyda / karma.conf
Created March 30, 2015 19:50
mocha + karma coverage
var baseConfig = require('./karma.conf.js');
module.exports = function (config) {
// Load base config
baseConfig(config);
// Override base config
config.set({
...
(function(window, document, $) {
var FANCYBOX_OVERLAY = ".fancybox-overlay";
$(document).ready(function () {
var paceLoading = {
hideLoading: function() {
Pace.stop();
$(FANCYBOX_OVERLAY).show();
},