Skip to content

Instantly share code, notes, and snippets.

@maciekrb
maciekrb / storyblok-sgqlc.py
Created April 5, 2022 14:53
Python GraphQL Storyblok sgqlc example
# Run the following to obtain storyblok_schema
# python -m sgqlc.introspection \
# --exclude-deprecated \
# --exclude-description \
# -H "Token: <some-token>" \
# https://gapi.storyblok.com/v1/api storyblok_schema.json
# sgqlc-codegen schema storyblok_schema.json storyblok_schema.py
import pytest
from sgqlc.endpoint.http import HTTPEndpoint
@maciekrb
maciekrb / storyblok-qlient.py
Created April 5, 2022 14:47
Python GraphQL qlient StoryBlok example
import pytest
import requests
from qlient import Client, Fields, HTTPBackend
@pytest.fixture
def qlient():
url = "https://gapi.storyblok.com/v1/api"
headers = {"Token": "<some-token>"}
session = requests.Session()
@maciekrb
maciekrb / PubSub to BigQuery using Dataflow
Created December 25, 2017 12:25
Dataflow pipeline to read from a Google Pub/Sub topic and write into a BigQuery table
package com.healthifyme.dftrial;
import com.google.api.services.bigquery.model.TableRow;
import com.google.api.services.bigquery.model.TableSchema;
import com.google.api.services.bigquery.model.TableFieldSchema;
import com.healthifyme.dftrial.common.ExampleUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;
@maciekrb
maciekrb / _INSTALL.md
Created October 20, 2016 23:21 — forked from robinsmidsrod/_INSTALL.md
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@maciekrb
maciekrb / drone.yml
Created February 24, 2016 20:00
drone config file
clone:
recursive: true
submodule_override:
clandmark: https://bitbucket.org/company/clandmark.git
build:
image: docker:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
@maciekrb
maciekrb / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?PHP
require_once DRUPAL_ROOT. '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// Change query-strings on css/js files to enforce reload for all users
_drupal_flush_css_js();
drupal_clear_css_cache();
drupal_clear_js_cache();
class VariableGroup(EndpointsModel):
_message_fields_schema = ('name', 'id', 'tags', 'identifier')
acl = ndb.StructuredProperty(AclRule)
tag_keys = ndb.KeyProperty(kind='Tag', repeated=True)
group_id = ndb.StringProperty()
name = ndb.StringProperty()
@property
def identifier(self):
if self.group_id is None:
@maciekrb
maciekrb / gist:3127695
Created July 17, 2012 06:55
string sanitize
def sanitize(string,separator='-'):
string = string.lower()
string = unicodedata.normalize('NFKD',string).encode('ascii','ignore')
rx = re.compile('\W+')
string = rx.sub('',string.replace(' ','SP'))
sprx = re.compile(r'\s+')
string = sprx.sub('',string)
string = string.strip()
string = string.encode('ascii','ignore')
string = string.replace(' ','')