Skip to content

Instantly share code, notes, and snippets.

@jasonphillips
jasonphillips / graphql_tools.py
Last active April 7, 2020 12:38
python graphql-tools imitation
import graphql
# build_executable schema
#
# accepts schema_definition (string) and resolvers (object) in style of graphql-tools
# returns a schema ready for execution
def build_executable_schema(schema_definition, resolvers):
ast = graphql.parse(schema_definition)
schema = graphql.build_ast_schema(ast)
@ruanbekker
ruanbekker / docker-nfs-volumes.md
Created December 10, 2017 10:43
NFS Volumes with Docker Swarm

Create NFS Volumes:

Creating the NFS Volume:

$ docker volume create --driver local \
  --opt type=nfs \
  --opt o=addr=192.168.1.115,uid=1000,gid=1000,rw \
  --opt device=:/mnt/volumes/mysql-test \
  mysql-test-1
@mlabouardy
mlabouardy / docker-compose.yml
Created November 1, 2017 19:07
Traefik example with Swarm mode
version: "3.3"
services:
traefik:
image: traefik:1.4
ports:
- 80:80
- 8080:8080
networks:
- traefik-net
@remorses
remorses / client.html
Created September 17, 2017 17:57 — forked from diorahman/client.html
Ajax, call jQuery POST to node.js expressjs
<html>
<head>
<title>jsonp test</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#select_link').click(function(e){
e.preventDefault();
console.log('select_link clicked');
@tseho
tseho / config.yml
Last active April 5, 2022 20:38
circleci + docker-compose + layers cache
version: 2
jobs:
build:
docker:
- image: docker:17.06.0-ce-git
steps:
- checkout
- setup_remote_docker
- run:
name: Install Docker Compose
@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active May 5, 2024 04:26
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@yacafx
yacafx / default
Last active February 9, 2023 20:07
NGNIX configuration for run node app and php app at the same same time - This configuration made Node and Wordpress working at the same time on two different routes.
### /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.php;
@jaradc
jaradc / entropy_calculation_in_python.py
Last active April 3, 2024 18:16
Four different ways to calculate entropy in Python
import numpy as np
from scipy.stats import entropy
from math import log, e
import pandas as pd
import timeit
def entropy1(labels, base=None):
value,counts = np.unique(labels, return_counts=True)
return entropy(counts, base=base)
#!/bin/bash
# https://codefresh.io/blog/deploy-docker-compose-v3-swarm-mode-cluster/
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
@54chi
54chi / Making it work for Mac OS.md
Last active July 15, 2021 20:06
LG UltraWide settings

How to create a 1280x1080 (among others) scaled resolutions for your non-standard monitor

Ultrawide monitors with PBP (Picture by Picture) are becoming more common these days. It allows you to split the screen and connect multiple sources to your monitor (e.g. 2 computers at the same time)

The problem is that the resolution is typically not supported out of the box (E.g. a 2560x1080 monitor, when split into 2 will require a 1280x1080 resolution, which is not standard in Mac OS as of Sierra)

Creating custom resolutions

First, we have to reboot in rootless mode, and disable the Integrity Protection, so we can create/override the screen file settings: