Skip to content

Instantly share code, notes, and snippets.

@magwas
magwas / gist:53d4cfcb7769d9f7f5ef5978fa121bf9
Created February 7, 2023 06:49
diff between nonworking and working setup
diff --git a/.classpath b/.classpath
index 32cc52b..1e553d7 100644
--- a/.classpath
+++ b/.classpath
@@ -36,10 +36,10 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
@magwas
magwas / gist:7f22da6ed9c88821af7fe3e244aaa5ca
Last active November 15, 2020 09:18
Read a fef file to FreeCAD
import Draft
import FreeCAD
def pointToCoords(point):
x=float(point[0])*1000
y=float(point[1])*1000
z=float(point[2])*1000
return (x,y,z)
def fefread(feffile):
@magwas
magwas / gist:01137443e6690b3231011364d2cea568
Last active December 7, 2019 21:14
an XSLT challenge
Please consider the following output. It was created by running an xslt script on itself.
You can easily reconstruct most of the script from this output. Most of it.
Level 0: reconstruct the script
Level 1: modify the script such that all of the script is reconstructable from its output
Level 1a: modify the script such that the output is "better" in some ways. E.g. ';' instead of '{}',
omission of things like 'select=', 'name=', 'test=' where it is unambigous, use 'let' or 'var' instead of xsl:variable,
'/"<pattern>"/' instead of 'xsl:template(match="<pattern>")', etc.
Level 2: modify the script such that it emits all xml constructs in a reconstructable way (e.g. processing instructions)
Level 3: write something which actually reconstructs the original xml
Level 4: write the reconstructing logic in xslt
in github I created a 'github application', with user authorization callback url as https://kode-konveyor.eu.auth0.com/login/callback
in auth0 I have created a 'regular web application', and enabled github.
relevant apache configuration:
DocumentRoot /var/www/repo
OIDCProviderMetadataURL https://kode-konveyor.eu.auth0.com/.well-known/openid-configuration
OIDCClientID Iv1.e37ead34f234dcfe
OIDCClientSecret '<the auth0 client secret>'
@magwas
magwas / gist:9b78d86732640e5f67491c707b4d5d18
Last active March 30, 2016 23:24
drone.io and gitlab
dronestart script. You run it once, and you will have a daemon forever. Docker makes sure that the container is started whenever docker starts.
#!/bin/bash
set -x
docker kill drone
docker rm drone
docker run \
--volume /var/lib/drone:/var/lib/drone \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /etc/ssl:/etc/ssl:ro \
@magwas
magwas / gist:5f9eb73165fe4a24e458
Created March 27, 2015 13:01
tomcat goodies: logging to syslog, keystore
mag@tomcat:~$ cat /etc/tomcat7/logging.properties
handlers= com.agafua.syslog.SyslogHandler
.level= INFO
# Syslog logger
com.agafua.syslog.SyslogHandler.transport = udp
com.agafua.syslog.SyslogHandler.facility = local0
com.agafua.syslog.SyslogHandler.port = 514
com.agafua.syslog.SyslogHandler.hostname = localhost
@version: 3.5
@include "scl.conf"
# First, set some global options.
options { chain_hostnames(off); flush_lines(0); use_dns(no); use_fqdn(no);
owner("root"); group("adm"); perm(0640); stats_freq(0);
bad_hostname("^gconfd$");
};
@magwas
magwas / gist:d1c7ba856925ba843e61
Last active August 29, 2015 14:17
scripts to set up cryptographical identity of a host (private key, certificates in pem, pkcs12 and java keystore format)
# ----------------/usr/local/bin/mkidentity_req -------------
#!/bin/bash
cd /etc/ssl/private/
hostname=$(hostname -f)
echo "creating request for $hostname"
openssl req -subj "/CN=$hostname/" -new -newkey rsa:2048 -passout pass:changeit -out newreq.pem
openssl rsa -in privkey.pem -out privkey.key -passin pass:changeit
cp newreq.pem ~
echo req is at ~/newreq.pem
#----------------------------------------------------------------
@magwas
magwas / gist:fe305050c035bd7f0cb5
Last active August 29, 2015 14:17
Simple command line app to test jdbc connectivity
//STEP 1. Import required packages
import java.sql.*;
public class JdbcQuery {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "org.postgresql.Driver";
public static void main(String[] args) {
if(args.length != 2) {
System.err.printf("usage: java [java opts] -cp <classpath containing jdbc driver and JdbcQuery> JdbcQuery <connection string> <sql>\n");