Skip to content

Instantly share code, notes, and snippets.

Grzegorz Wierzowiecki gwpl

Block or report user

Report or block gwpl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gwpl
gwpl / SSH-X11-Forwarding.md
Created Dec 15, 2011 — forked from adrianratnapala/SSH-X11-Forwarding.md
A note on X11-Forwarding in SSh.
View SSH-X11-Forwarding.md

I used to think that

ssh -X me@some.box

"just bloody worked". However this might not work - ssh must play ball on both sides of the link. On the remote (ssh server, X client) sshd must sit behind some port, tell Xlib to send X11 requests to it and then forward them back to you the X server (where the ssh client is). If the remote box is locked down to prevent this, you will get:

X11 forwarding request failed on channel 0

as part of an otherwise working login. As it happens, I am the admin of the remote box in question, so I followed the ArchWiki and went to /etc/ssh/sshd_config and uncommented

@gwpl
gwpl / LICENSE.The Unlicense
Last active Jan 24, 2016
barcodes_labels_test.tex - test of barcodes printing for Emerson 525x25,4mm paper on HP 3525 Ink Advantage. (Before I make repo, let's make it gist. Licence: as it is just LaTeX document, I give it with no warranty to Public Domain, let's use "The Unlicense" license (even more permissive then CC0) following advice on : http://choosealicense.com/…
View LICENSE.The Unlicense
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@gwpl
gwpl / clean.sh
Last active Feb 5, 2020
`openssl pkeyutl` how to: -sign -verify -encrypt -decrypt , using openssh keys snippets/examples
View clean.sh
rm -v pub.pkcs8 test.sign test.txt.decrypted test.txt.encrypted
View whitelisting_wrapper.sh
#!/bin/bash
LOGFILE=/home/"${USER?}"/.ssh_last_wrapper_invocation_error.log
SSHHISTORY=/home/"${USER?}"/.ssh_commands_history
ALLOWED_COMMANDS=/etc/ssh/users_configs/"${USER?}"/allowed_commands
if [ "$1" == 'make_files_for_user' ]; then
if [ -z "$2" -o -z "$3" ]; then
echo Usage: $0 make_files_for_user Username Groupname
exit 1
@gwpl
gwpl / only_exec_command.c
Last active Apr 30, 2016
It is "pseudo-shell" that will only execute provided -c command. Might be helpful for sshd users configured with "ForcedCommand" and "ChrootDirectory". (example with further references: https://goo.gl/TjhrWd ). License: This is trivial code snippet directly based on documentation and C specification, please consider it public domain.
View only_exec_command.c
#include <unistd.h>
// compile with: gcc only_exec_command.c -static -o only_exec_command
// It is "pseudo-shell" that will only execute provided -c command.
// Usage : ./only_exec_command -c /bin/echo This is test
// Please note that this is far from perfect. It should actually parse and split string
// provided in argv[2], like shlex.Split in python. However, it's enought for my application
// of running one binary specified in ForceCommand sshd_config option.
int main(int argc, char **argv){
@gwpl
gwpl / README.md
Last active Jan 12, 2019
Adding Custom Page to ppd. Definition of S0929100 Cards for LabelWriter printers (including Dymo 450 LabelWriter), as this roll is missing in Linux Drivers (lw450.ppd and other .ppd files) and Macintosh dymo.ppd file. It's reconstructed by hand. I've send email to technical support, so let's work on this one until official specification for roll…
View README.md

Definition of S0929100 Cards for LabelWriter printers (including Dymo 450 LabelWriter), as this roll is missing in Linux Drivers (lw450.ppd and other .ppd files) and Macintosh dymo.ppd file. It's reconstructed by hand. I've send email to technical support, so let's work on this one until official specification for roll will arrive.

Please note you need to add each line to appropriate section in .ppd file according to : http://stackoverflow.com/a/3112256/544721 (On my systems, lw450.ppd files were located in /usr/share/cups/model/lw450.ppd)

Update: When I tried to apply patch below on dymo-cups-drivers-1.4.0.5 (dymo-cups-drivers-1.4.0.tar.gz), it turned out that there is already another definition of w144h252 page. Testing:

View passwordcard_template.tex
\documentclass[fontsize=8.5pt]{scrartcl}
% set page size
\usepackage{geometry}
\geometry{
paperwidth = 3.5in,
paperheight = 2in,
margin = 0.15in,
}
@gwpl
gwpl / README.txt
Last active May 7, 2016
systemd.timer example: rsync_userx_to_remotey.sh rsync script example with pidfile and trap for the purpose of https://goo.gl/rzTJD1
View README.txt
Copy&Paste of : https://goo.gl/rzTJD1
self-link (web): https://goo.gl/rzTJD1
self-link (doc): https://goo.gl/kZDBHC
# linux userX -> remotey (only over local network)
Notes from setting rsync systemd.timer .
systemd.timers
references:
https://www.freedesktop.org/software/systemd/man/systemd.timer.html
https://www.freedesktop.org/software/systemd/man/systemd.unit.html
@gwpl
gwpl / fstab
Last active May 7, 2016
sshfs mount config snippets
View fstab
#/etc/fstab
# remote on remoteY ( remoteY has to be defined in /root/.ssh/config,/home/userX/.ssh/config )
userX@remoteY:/mnt/remoteY/ext4/userX/mount /mnt/remoteY_mount fuse.sshfs noauto,x-systemd.automount,x-systemd.device-timeout=10,_netdev,user,idmap=user,transform_symlinks,identityfile=/home/gwpl/.ssh/id_ecdsa521_sftplenovox230,allow_other,default_permissions,uid=123456789,gid=100,reconnect 0 0
# assuming 123456789 is UID and 100 GID desired of mount
@gwpl
gwpl / standalone_verbatim.tex
Last active May 9, 2016
standalone_verbatim.tex is parametrized tex template, that genrates cropped pdf containing given text verbatim of given file in monospace. Just compile below, or get some ascii art penguin into penguin.txt (e.g. from: http://chris.com/ascii/index.php?art=logos%20and%20insignias/linux ) and run: $ pdflatex '\def\txtfile{penguin.txt} \input{standa…
View standalone_verbatim.tex
% Following standalone configuration: http://tex.stackexchange.com/a/94395/7128
\documentclass[varwidth=\maxdimen]{standalone}
% Usage: pdflatex '\def\txtfile{input.txt} \input{this_document_template.tex}'
% Example pdflatex '\def\txtfile{penguin.txt} \input{standalone_verbatim.tex}'
\usepackage{verbatim}
\begin{document}
% following http://tex.stackexchange.com/a/1495/7128
\ifdefined\txtfile
%
%Specified file: \txtfile
You can’t perform that action at this time.