Skip to content

Instantly share code, notes, and snippets.

View silkentrance's full-sized avatar

Carsten Klein silkentrance

View GitHub Profile
@silkentrance
silkentrance / auth.py
Created May 15, 2015 13:35
Django 1.8.1 Auth Integration for Mongoengine <0.9.0
# adapted from django.contrib.auth
#
# simply import the here provided login() to make mongoengine work with Django 1.8.1
from django.conf import settings
from django.middleware.csrf import rotate_token
from django.utils.translation import LANGUAGE_SESSION_KEY
from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
from django.contrib.auth import SESSION_KEY, BACKEND_SESSION_KEY, HASH_SESSION_KEY, REDIRECT_FIELD_NAME, get_user_model, load_backend
from bson import ObjectId
@silkentrance
silkentrance / cli.js
Last active November 7, 2016 18:45
Miscellaneous PEGJS grammars, a CLI testing frontend and input data
#!/usr/bin/env /usr/bin/node
// usage ./cli [grammar.js] unit.ypo
// default grammar is ypo.js
var fs = require('fs');
var path = require('path');
var util = require('util');
@silkentrance
silkentrance / gist:8133476645f9ce7bcf5b
Last active February 22, 2016 23:28
Example impl
import util from 'util';
function hypotheticalDecoratorThatMerges(target, key, descriptor)
{
let result = descriptor;
if ('get' in descriptor || 'set' in descriptor)
{
const desc = {};
Object.keys(descriptor).forEach(
import { decorate } from './private/utils';
// WIP: prototypical, might not be working at all, needs additional work!
function findSuperDesc(superklass, key)
{
let result;
let supklass = superklass;
while (supklass.prototype)
{
if (Object.hasOwnProperty(supklass, key))
@silkentrance
silkentrance / cfgsection
Last active April 28, 2016 18:14
Add/remove a marked section from a config file
#!/bin/bash
CMD=$(basename $0)
SED=$(which sed)
GREP=$(which grep)
ECHO=$(which echo)
CUT=$(which cut)
CAT=$(which cat)
@silkentrance
silkentrance / SyncStream.py
Last active April 9, 2017 22:40
GRPC Python Request and Response Streaming
import threading
from time import sleep
DEFAULT_SLEEP_TIME = 0.00001
class SyncStream:
def __init__(self, sleep_time = DEFAULT_SLEEP_TIME):
@silkentrance
silkentrance / MyComponent.ts
Last active March 10, 2021 13:09
vue-router typescript integration fails
import Vue from 'vue';
import Component from 'vue-class-component';
@Component({
name : 'component'
})
export default class MyComponent extends Vue {
beforeCreate() {
@silkentrance
silkentrance / README.md
Last active August 7, 2019 22:19
Vuetify with TypeScript

Vuetify with TypeScript

The following changes to the standard setup of the vuetify template will allow you to use typescript instead of babel or just plain javascript.

WORK IN PROGRESS

Additional changes have to be made to vuetify in order to get this running, namely the vuetify typescript declarations. I am currently working on that. Patience is a virtue.

@silkentrance
silkentrance / Jenkinsfile
Created March 25, 2019 13:53
Maven custom build versions that include jira issue id from branch name
pipeline {
agent any
environment {
V_DEPLOY_VERSION = buildDeployVersion(readMavenPom().getVersion())
}
stages {
stage('Version') {
steps {
@silkentrance
silkentrance / README.md
Last active February 6, 2020 00:54
A jest test environment for use with node tmp - temporary work around for https://github.com/raszi/node-tmp/issues/229

A real version of this will be released soon that can then be installed using npm/yarn.