Skip to content

Instantly share code, notes, and snippets.

View itajaja's full-sized avatar
🐼
blip blop

Giacomo Tagliabue itajaja

🐼
blip blop
View GitHub Profile
class: SchemaDefRequirement
types:
- name: Reference
type: record
fields:
- name: file
type: File
- name: metadata
type: string?
@itajaja
itajaja / createInfiniteList.ts
Created July 25, 2019 07:57
createInfiniteList.ts
import React from 'react';
import {
ConnectionConfig,
GraphQLTaggedNode,
RelayPaginationProp,
createPaginationContainer,
} from 'react-relay';
import InfiniteList from '@bfly/ui/lib/InfiniteList';
export const PAGE_SIZE = 30;
@itajaja
itajaja / PercySeleniumClient.js
Created November 8, 2018 22:07
PercySeleniumClient.js
import PercyClient from 'percy-client';
// https://github.com/percy/percy-webdriverio/blob/master/src/fileSystemAssetLoader.js
import FileSystemAssetLoader from './fileSystemAssetLoader';
export default class PercySeleniumClient {
constructor({ driver, assetLoaderOpts, ...clientOptions }) {
this.percyClient = new PercyClient({
token: process.env.PERCY_TOKEN,
apIUrl: process.env.PERCY_API,
@itajaja
itajaja / jaja.zsh-theme
Created October 16, 2016 19:26
oh my zsh Theme containing kubernetes and git info
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} %{$fg_bold[blue]%}k8s:(%{$fg[red]%}$(kubectl config current-context)%{$fg_bold[blue]%}) $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
import json
import logging
from string import Template
from subprocess import CalledProcessError, check_output
from time import sleep
class PyKubectl(object):
def __init__(self, bin='kubectl', extra_args=''):
super(PyKubectl, self).__init__()
@itajaja
itajaja / auth0.sh
Created July 19, 2016 22:37
get a jwt token
set -eu
domain=$1
client_id=$2
connection=$3
username=$4
password=$5
http --json POST https://$domain.auth0.com/oauth/ro client_id=$client_id username=$username password=$password connection=$connection scope="openid organization perms user_type" | jq .id_token -r |pbcopy
from airflow import DAG
from airflow.operators import EcsOperator, PythonOperator
from datetime import datetime
import os
from utils import get_last_run_date
# -----------------------------------------------------------------------------
ECS_CLUSTER = os.environ['XXXX_AIRFLOW_ECS_CLUSTER']
@itajaja
itajaja / gist:94669d0be2115556739b
Created October 27, 2014 14:10
drop and restore DB
USE [master]
ALTER DATABASE <DbName> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE <DbName> FROM DISK = '<Path to Backup file>'
GO
@itajaja
itajaja / Cloner.cs
Last active January 1, 2016 02:19
Deep clones an object using serialization
/// <summary>
/// Deep clones an object using serialization
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj">The object to be cloned</param>
/// <returns>A copy of the object not sharing any references with the original one</returns>
public static T DeepClone<T>(T obj)
{
using (var ms = new MemoryStream())
{
using System;
using System.Linq;
using Ninject;
using Ninject.Extensions.Conventions;
/// <summary>
/// Extensions method to handle plugins
/// </summary>
public static class NinjectPlugin
{