Skip to content

Instantly share code, notes, and snippets.

View Querela's full-sized avatar

Erik Körner Querela

View GitHub Profile
@Querela
Querela / gist:4e16d944ad6ad8a91c98da7a50902e60
Created August 12, 2020 19:24 — forked from zzzeek/gist:a3bccad40610b9b69803531cc71a79b1
how to do CIDR overlapping in SQL with SQLite / MySQL / SQLAlchemy
from sqlalchemy import event
from sqlalchemy import DDL
def _mysql_cidr_overlap(metadata):
@event.listens_for(metadata, "after_create")
def _create_mysql_proc(target, connection, **kw):
if connection.engine.name != 'mysql':
return
@Querela
Querela / strsplit.sql
Created August 12, 2020 20:15 — forked from paulochf/strsplit.sql
MySQL split function: get nth splitted term from string separated value
-- Retrieved from http://dev.mysql.com/doc/refman/5.6/en/string-functions.html at 2015-feb-10 18:16
-- Working on MySQL version 5.6.19-0ubuntu0.14.04.1 (Ubuntu)
--
-- Posted by Chris Stubben on August 21 2008 3:49pm
-- Split delimited strings
CREATE FUNCTION
strSplit(x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS VARCHAR(255)
return
REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
@Querela
Querela / idea.md
Created November 21, 2021 10:05 — forked from motorailgun/idea.md
Installing Windows and Linux into the same partition

Installing Windows and Linux into the same partition

But WHY?

There was a reddit post about installing Arch on NTFS3 partition. Since Windows and Linux doesn't have directories with same names under the /(C:\), I thought it's possible, and turned out it was actually possible.
If you are not familiar to Linux, for example you've searched on Google "how to dualboot Linux and Windos" or brbrbr... you mustn't try this. This is not practical.

Pre-requirements

  • UEFI system
  • Any Linux live-boot CD/DVD/USB... with Linux kernel newer than 5.15
  • Windows installer USB
@Querela
Querela / Application.Java
Created September 14, 2022 11:11 — forked from aweiland/Application.Java
CORS in Dropwizard
private void configureCors(Environment environment) {
final FilterRegistration.Dynamic cors =
environment.servlets().addFilter("CORS", CrossOriginFilter.class);
// Configure CORS parameters
cors.setInitParameter(CrossOriginFilter.ALLOWED_ORIGINS_PARAM, "*");
cors.setInitParameter(CrossOriginFilter.ALLOWED_HEADERS_PARAM, "X-Requested-With,Content-Type,Accept,Origin,Authorization");
cors.setInitParameter(CrossOriginFilter.ALLOWED_METHODS_PARAM, "OPTIONS,GET,PUT,POST,DELETE,HEAD");
cors.setInitParameter(CrossOriginFilter.ALLOW_CREDENTIALS_PARAM, "true");