Skip to content

Instantly share code, notes, and snippets.

View sobi3ch's full-sized avatar
🎯
Focusing

Piotr Sobieszczański sobi3ch

🎯
Focusing
View GitHub Profile
@founddrama
founddrama / VersionComparator.groovy
Last active October 28, 2024 09:31
a version comparator (e.g., "1.0.2" < "1.0.10")
def versions = []
def f = new File('mock-version-tags.txt')
f.eachLine { versions << it }
def versionComparator = { a, b ->
def VALID_TOKENS = /._/
a = a.tokenize(VALID_TOKENS)
b = b.tokenize(VALID_TOKENS)
for (i in 0..<Math.max(a.size(), b.size())) {
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active August 20, 2024 20:28
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@carlwiedemann
carlwiedemann / gist:4035400
Created November 7, 2012 23:40
Drush login, Drush logout
# Drush login function dli
# ------------------------
#
# Open the given site in the browser, login as root, and go to destination
# argument. Requires the -l option, or drush site-set @alias, or $options['l']
# in sites/default/bashrc.php
#
# Usage
# -----
#
@ashrithr
ashrithr / rsc
Last active December 11, 2015 22:49
manage create/manage rackspace virtual machines using command line api (nova client)
#!/usr/bin/env bash
####################
#
# Wrapper script to manage virtual machines in rackspace using nova-client & rackspace api v2
# Author: Ashrith
#
####################
##NOVA AUTH VARIABLES
export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
@VeggieMeat
VeggieMeat / Determine if D7 Rules action is active
Created November 19, 2013 09:44
Determine if a particular action in Drupal 7 Rules 2 is part of any active rule.
$action_name = 'r2d2';
$rules = rules_config_load_multiple(FALSE);
foreach ($rules as $rule) {
if (get_class($rule) == 'RulesReactionRule') {
foreach ($rule->actions() as $action) {
if (get_class($action) == 'RulesAction') {
if (($action->getElementName() == $action_name) && ($rule->active == 1)) {
return 'that was the droid you were looking for';
}
@andyrbell
andyrbell / docker-image-size.sh
Last active June 3, 2024 16:58
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t
@brunosimioni
brunosimioni / docker-compose.yml
Created February 27, 2018 17:46
Docker Compose to Prometheus, PushGateway and Grafana setup
version: '2.1'
networks:
monitor-net:
driver: bridge
volumes:
prometheus_data: {}
grafana_data: {}
@vades
vades / laravel-auto-refresh.md
Last active November 11, 2024 17:41
Auto refresh after changes with Laravel Mix

Laravel auto refresh after changes

To achieve this you can use Laravel Mix

  1. Ensure that Node.js and NPM are installed: run node -v and npm -v.
  2. Install Laravel Mix npm install.
  3. Open webpack.mix.js and add mix.browserSync('127.0.0.1:8000');.
  4. Run php artisan serve.
  5. And the npm run watch.

Sources

@shalkam
shalkam / .gitlab-ci.yml
Created May 20, 2019 08:52
using service account
stages:
- deploy
deploy_app:
image: bitnami/kubectl:latest
stage: deploy
environment: production
script:
- USER_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
- CERTIFICATE_AUTHORITY_DATA=$(cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | base64 -i -w0 -)
- kubectl config set-cluster k8s --server="https://kubernetes.default.svc"
@ciiqr
ciiqr / dispatch.sh
Last active October 9, 2024 14:38
github actions, repository_dispatch with client_payload
# TODO: replace :token, :user, and :repo
curl -H "Authorization: token :token" \
-H 'Accept: application/vnd.github.everest-preview+json' \
"https://api.github.com/repos/:user/:repo/dispatches" \
-d '{"event_type": "awesomeness", "client_payload": {"foo": "bar"}}'