Skip to content

Instantly share code, notes, and snippets.

@rplantiko
rplantiko / dpl.sh
Last active Dec 11, 2017
Delete Mozilla Firefox' .parentlock
View dpl.sh
#!/bin/bash
HOME=/data/nethome
USER=$1
if [ $# -ne 1 ]; then echo "=========================================================
Löschen der Firefox-Sperrdatei .parentlock für einen User
=========================================================
Verwendung:
View BitField.class.js
// A bitfield represents a binary number of arbitrary length
// This implementation requires the JavaScript Uint32Array data type
function BitField(length,data) {
if (length instanceof BitField) {
// Copy-Constructor from a given BitField
this.length = length.length
this.maxIndex = length.maxIndex
this.maxMask = length.maxMask
this.maxPlaces = length.maxPlaces
this.data = Uint32Array.from(length.data)
View RedirectLogin.java
package loginServices;
import com.sap.security.core.logon.imp.SAPJ2EECallbackHandler;
import com.sap.engine.interfaces.security.auth.LoginContextFactory;
import java.io.IOException;
import java.io.PrintWriter;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
View ephemeris.h
#include "fcgi_stdio.h"
#include <unistd.h>
#include <setjmp.h>
#include <stdbool.h>
#include "../../swisseph/src/swephexp.h"
const char* EPHE_PATH = "/usr/swisseph/ephe";
const int MAXLEN_EPHE_PATH = 132;
View ephemeris.c
/*
ephemeris via fastcgi
See http://swepar.blogspot.ch/2015/07/ein-exkurs-fast-cgi.html
*/
#include "ephemeris.h"
int main (int argc, char** argv) {
View test-printf-fastcgi.c
#include "fcgi_stdio.h"
#include <unistd.h>
void print_numbers( double* numbers, int n) {
for (int i=0;i<n;i++) {
printf("%s%.4lf",i>0?",":"",numbers[i]);
}
printf("\r\n");
}
@rplantiko
rplantiko / gist:b92f0231c4e149bf75aa
Created Jul 10, 2015
XML beautifier with attribute alignment
View gist:b92f0231c4e149bf75aa
/* global process */
// A simple xml beautifier, based on the xml2js parser
// - align attribute names (this is what xmlbuilder can't do)
// - indent by 2 spaces
// Don't expect too much:
// xml2js can't handle mixed element content:
// <a>b<c/>d</a> is equal to <a>bd<c/></a> in the eyes of xml2js
@rplantiko
rplantiko / eslint-rules.json
Last active Aug 29, 2015
JavaScript - additional ESLint rules
View eslint-rules.json
{
"basevalidator": {
"validators": [
{
"validatorID": "jsValidator",
"configuration": {
"eslintConfig": {
"rules": {
"block-scoped-var": 2,
"brace-style": 0,
@rplantiko
rplantiko / json2data.abap
Created Apr 2, 2012 — forked from mydoghasworms/json2data.abap
Added some module tests
View json2data.abap
REPORT ZZ_TEST_JSON_MYDOG.
*
class lcl_test definition for testing " #AU Risk_Level Harmless
inheriting from cl_aunit_assert. " #AU Duration Short
private section.
methods :
test_string for testing,
test_number for testing,