Skip to content

Instantly share code, notes, and snippets.

View loplex's full-sized avatar

Martin (Lopin) Lopatář loplex

  • DataPLEX
  • Brno, Czech Republic
  • 13:51 (UTC +02:00)
View GitHub Profile
@loplex
loplex / txt
Created February 17, 2016 01:49
gisttest1pub
pubtst
@loplex
loplex / Docker
Created April 23, 2017 13:14 — forked from mitchwongho/Docker
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
#!/bin/sh
### it will call 'inspect' on found docker volumes by default, you can delete them providing 'rm' as parameter
docker_volume_action=${1:-inspect}
#echo $docker_volume_action
docker volume ls -qf dangling=true | xargs -r docker volume $docker_volume_action
#!/bin/bash
#DOCKER_REGISTRY_IMAGE=""
#GITLAB_PERSONAL_ACCESS_TOKEN=""
#GITLAB_PERSONAL_ACCESS_SECRET=""
AUTH_URL="https://gitlab.com/jwt/auth"
AUTH_SERVICE="container_registry"
#echo "GITLAB_PERSONAL_ACCESS_TOKEN:GITLAB_PERSONAL_ACCESS_SECRET: $GITLAB_PERSONAL_ACCESS_TOKEN:$GITLAB_PERSONAL_ACCESS_SECRET"
@loplex
loplex / uniq_lines.sh
Last active July 5, 2018 20:20
print duplicated lines only once without need of sorted input
#!/bin/sh
# print duplicated lines only once without need of sorted input
awk '!seen[$0]++' $@
@loplex
loplex / vpnc-script-win.js
Created February 22, 2019 18:37
vpnc script for openconnect.exe (on windows) that works for me
// vpnc-script-win.js
//
// Sets up the Network interface and the routes
// needed by vpnc.
var internal_ip4_netmask = "255.255.255.0";
var ws = WScript.CreateObject("WScript.Shell");
var env = ws.Environment("Process");
var comspec = ws.ExpandEnvironmentStrings("%comspec%");
rem From: https://superuser.com/a/301026/952328 and https://stackoverflow.com/a/7366200/3295944
rem Official setup has command line arguments: https://cygwin.com/faq/faq.html#faq.setup.cli
rem Cygwin package list: https://cygwin.com/packages/package_list.html
rem Cygwin package search: https://cygwin.com/cgi-bin2/package-grep.cgi
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --root "%cd%" --packages %*
@loplex
loplex / ptswrite.py
Created April 14, 2019 08:45
allows to send data to STDIN of another process already running having STDIN attached to terminal
#!/usr/bin/python2.7
### allows to send data to STDIN of another process already running having STDIN attached to terminal
### FROM: https://stackoverflow.com/a/29616465/3295944
### but it doesn't work (fail process command line argument), but fixed here
'''
Here is how you use it:
#!/bin/sh
to_user=$1
xauth extract - $DISPLAY | sudo env -i su ${to_user} -c 'xauth merge -'
#!/bin/sh
# apt install exe-thumbnailer gridsite-clients
exe_file=$1
exe_file_abs=$(readlink -f "$exe_file")
output_file="${exe_file_abs}.png"
exe_file_url="file://$(urlencode -m "$exe_file_abs")"
set -x
echo "" | /usr/bin/exe-thumbnailer "$exe_file_abs" "$output_file" "$exe_file_url" || exit 1
set +x
echo "Created: $output_file"