Skip to content

Instantly share code, notes, and snippets.

View basdek's full-sized avatar

Sebastiaan de Kwant basdek

  • Quant Development
  • The Netherlands
View GitHub Profile
Rescheduling beheer.views.create_new_contract
Traceback (most recent call last):
File "/home/website/env/lib/python3.6/site-packages/background_task/tasks.py", line 43, in bg_runner
func(*args, **kwargs)
File "/home/website/bijlesmeester/new_bijles_site/beheer/views.py", line 10983, in create_new_contract
pdf=SimpleUploadedFile(f"contract_{d.user.last_name}_{now.split('T')[0]}.pdf", response.content)
File "/home/website/env/lib/python3.6/site-packages/django/db/models/base.py", line 741, in save
force_update=force_update, update_fields=update_fields)
File "/home/website/env/lib/python3.6/site-packages/django/db/models/base.py", line 779, in save_base
force_update, using, update_fields,
@basdek
basdek / .spacemacs
Last active July 7, 2019 12:54
Spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbkp9GXQUMs3b+jjBPrvqw11tbt7UiMN0m/ZpBOQzi8HP+cc4X4Rhq89SSdjQjoTSbSK6gimvT2bq2VxuRe1XswjgNBfax3UofP2ZdtyIRuLgO+A1xdEwN1st0ld4ZEy6R1+mmYespZHvAh9/jV2yhjhReF7i0hvMq1Dw4vSKUvS+UeWpRnab4lFNkgLHdYar0oKLOm+hBHEwIC2rSrucYiKE24fHdD9ms85YOom29EjyCvp3z1Bm/sagPgKidVeK8qK7TeagxvTyyaNVE/eHzG078Shp7PPdfoAzkXONTn9uPCF2IEneLWhHAn1EIiR3J7691Lu1GfrFDsx/kCv3p bas@bwv1017
A 1 2 ..50
B 1 2 ..50
..n 1 2 ..50
@basdek
basdek / gist:a857fa590619d2fbe847
Created February 24, 2016 19:26
Git cherry pick a merge
The way I usually do this is using git rebase:
git rebase --onto C A B
This takes the diffs between A and B, and applies those diffs to branch C. As a bonus, the rebase will skip any commits between A and B that perform the same textual change as already exists in branch C.
Update: In the case you mentioned in the comments, remember that Git never overwrites past history. So even after doing the rebase above, you could recreate a new branch head at the commit where B used to be before the rebase. Unfortunately I can't think of a simple way to do that at this time of the morning. Sorry I couldn't be more help, perhaps somebody else will come up with an easy way!
//@TODO: probably belongs in the library as java helper.
def mergeFieldMerge(k: String, v: Object, map: Option[Map[String, Any]]) : Option[Map[String,Any]] = {
Option(Map[String, Any](k -> v) ++ map.getOrElse(Map[String,Any]()))
}
@basdek
basdek / .scala
Created February 13, 2016 13:08
Advanced pattern matching
trait MailChimpListSegment_Options_Condition {
def getConditionType : String
}
object MailChimpListSegment_Options_ConditionSerializer
extends CustomSerializer[MailChimpListSegment_Options_Condition](format => (
{
case JObject(JField("condition_type", JString("TextMerge")) ::
JField("field", JString(f)) :: JField("op", JString(o)) ::
JField("value", JString(v)) :: Nil) =>
@basdek
basdek / DateTest.java
Created January 24, 2016 16:11 — forked from jwgmeligmeyling/DateTest.java
Some tests on basic assumptions on Java's LocalDateTime
import org.junit.Test;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import static org.junit.Assert.assertEquals;
/**
@basdek
basdek / keyboard.sh
Created January 20, 2016 10:23
sane keyboard layout
setxkbmap -layout "us" -variant ="altgr-intl"
@basdek
basdek / Reverse proxy nginx file JWilder proxy box.conf
Created November 22, 2015 23:04
Reverse proxy nginx file JWilder proxy box.conf
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
# Om nom nom cookies
#
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';
#
# Custom headers and headers various browsers *should* be OK with but aren't