Skip to content

Instantly share code, notes, and snippets.

View remcoboerma's full-sized avatar

Remco Boerma remcoboerma

  • Education Warehouse, verZimpel, Dutveul
  • Assen, the Netherlands
View GitHub Profile
@plentz
plentz / nginx.conf
Last active July 17, 2024 09:16
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

import random
import time
import numpy
from exceptions import ValueError
class PushID(object):
# Modeled after base64 web-safe chars, but ordered by ASCII.
PUSH_CHARS = ('-0123456789'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
@arikfr
arikfr / query.py
Created May 21, 2015 15:19
re:dash Python datasource join example
# get existing queries results
users = get_query_result(132) # this one has {id, name}
events_by_users = get_query_result(131) # this one has {user_id, events count}
# actual merging. can be replaced with helper function and/or some Pandas code
events_dict = {}
for row in events_by_users['rows']:
events_dict[row['user_id']] = row['count']
for row in users['rows']:
@fiftin
fiftin / Convert PostgreSQL to SQLite
Created October 5, 2015 07:04
Convert PostgreSQL to SQLite
1. Dump the data only sql to file
$ pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql
2. scp to local
3. Remove the SET statements at the top
such as:
SET statement_timeout = 0;
SET client_encoding = 'SQL_ASCII';
4. Remove the setval sequence queries
@hideojoho
hideojoho / Vagrant_jupyterhub.md
Last active April 18, 2021 19:52
How to set up a JupyterHub server on Vagrant

What you will get

  • JupyterHub server for multiple users
  • Python libraries: numpy scipy pandas matplotlib (can be changed via Vagrant_provision.sh below)
  • Jupyter Notebook Extensions

Requirements

  • At least 6-8GB of RAM (of those 4GB will be used for a virtual machine)
  • About 2.5GB of diskspace
  • 1-2 hours of time (depends on your network speed)
@amix
amix / appear_applet.py
Last active June 24, 2017 10:55
How to implement the `/appear room-name` slash command on Twist using Flask.
# -*- coding: utf-8 -*-
"""
Start video conversations from Twist by just typing `/appear room-name`
"""
from flask import Flask
from flask import jsonify
from flask import request
app = Flask(__name__)
@kbni
kbni / encoder.py
Created March 2, 2018 05:02
Serialiser for nameko
import json
from datetime import datetime, timedelta
import pendulum
import pytz
from kombu.serialization import register
from miso.utils import ServiceResult
class SpecialJSONEncoder(json.JSONEncoder):
"""
@Mau5Machine
Mau5Machine / docker-compose.yml
Last active July 4, 2024 16:57
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always
@valq7711
valq7711 / async_pydal.py
Created June 1, 2021 20:25
async_pydal
from pydal import DAL
from voodoodal import DB, Table, Field, model
import aiosqlite
import asyncio
# async sqlexecuter
class SQLExecuter:
def __init__(self, pydal_adapter, adb_executer):
self.adb_executer = adb_executer
self.adapter = pydal_adapter