Skip to content

Instantly share code, notes, and snippets.

View spuk-'s full-sized avatar

Spuk spuk-

  • Curitiba-PR, Brasil
View GitHub Profile
@spuk-
spuk- / bash
Last active May 14, 2019 19:22 — forked from franklinbr/bash
#!/bin/bash
arquivo_entrada='script.sql'
arquivo_tmp='temporario.sql'
arquivo_saida='saida.sql'
cp "$arquivo_entrada" "$arquivo_saida" && sed -e "2,\${`head -n1 "$arquivo_entrada" | sed -r -e 's/, /\n/g' | while read var x val; do echo -n "s/$var\\>/$val/g;"; done`}" "$arquivo_saida"
@spuk-
spuk- / jboss-standalone.conf
Created March 23, 2018 20:54
Systemd service and EnvironmentFile for starting JBoss directly (Type=simple) instead of via standalone.sh or jboss-eap-rhel.sh. Based on what the scripts bundled with JBoss EAP 7 do.
JBOSS_BASE_DIR=/opt/jboss/standalone
JBOSS_LOG_DIR=/opt/jboss/standalone/log
JBOSS_LOG_CONF=file:/opt/jboss/standalone/configuration/logging.properties
JBOSS_MODULEPATH=/opt/jboss/modules
JBOSS_MODULES_SYSTEM_PKGS=org.jboss.byteman
JAVA_OPTS= \
-Xms1024m -Xmx1024m -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=512m \
-Djava.net.preferIPv4Stack=true \
-Djava.awt.headless=true
SERVER_OPTS=-c standalone.xml
@spuk-
spuk- / move-year-month-subdir.sh
Last active February 27, 2018 20:06
Move files older than 2018-01-01 to a $year/$month subdirectory.
find . -maxdepth 2 -type f -not -newermt 2018-01-01 | while read q ; do d=$(date -r "$q" +`dirname "$q"`/%Y/%m); mkdir -p "$d"; mv -vi "$q" "$d"; done
@spuk-
spuk- / pacman-sorted-by-size.sh
Created March 12, 2017 00:12
archlinux installed packages list sorted by size
pacman -Qi | awk -F ' *|:' 'BEGIN{mm["KiB"]=1024; mm["MiB"]=1024*1024; } /^Name/ { n=$4 } /^Installed Size/ { s=$5; s=s*mm[$6]; printf "%s %s\n", s, n } ' | sort -n
@spuk-
spuk- / jbossclifacts.sh
Last active February 21, 2017 18:48
Crude Ansible shellscript module to get facts about JBoss configuration using jboss-cli.sh
#!/bin/sh
# This Ansible module makes a very crude and error prone (didn't check all possible cases, "works for me")
# conversion from jboss-cli.sh output to JSON so as to provide facts to Ansible.
# How to use:
# - put it somewhere in your ANSIBLE_MODULES paths, ansible.cfg's library paths, or role/library/ directory
# - run the file name as a task
# parse ansible args
. "$1"
@spuk-
spuk- / pip-search-urllib2
Created April 24, 2014 14:16
Patch for making "pip search" use proxy set via *_proxy environment variables.
--- /usr/lib/python2.6/site-packages/pip/commands/search.py.orig 2014-04-24 10:31:14.551357257 -0300
+++ /usr/lib/python2.6/site-packages/pip/commands/search.py 2014-04-24 10:57:17.522362125 -0300
@@ -1,5 +1,6 @@
import sys
import textwrap
+import urllib2
import pip.download
@@ -12,6 +13,22 @@