Skip to content

Instantly share code, notes, and snippets.

View japrogramer's full-sized avatar
🌐
What is Inteligence?

japrogramer

🌐
What is Inteligence?
View GitHub Profile
@npearce
npearce / install-docker.md
Last active May 22, 2024 10:13
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@wyhasany
wyhasany / README.MD
Last active November 23, 2022 18:27
Yubikey/Yubicom/Yubico login/lock/unlock screensaver, greeter, pantheon-greeter Elementary OS

Summary:

Requirements:

OS: Elementary OS 0.4.1 Loki | Should work properly on other Debian based distro's, remember to change your screensaver command this might be different depending on the distro Yubikey: Yubikey II

Description:

This is a Short guide on how to get your Yubikey to work on Linux (Debian based) with the option to lock/unlock your screen using your Yubikey.

Features:

@tricoder42
tricoder42 / 00_GraphQL_Subscriptions.md
Last active February 22, 2023 12:40
GraphQL Subscriptions with django-channels

GraphQL Subscription with django-channels

Django channels are official way for implementing async messaging in Django.

The primary caveat when working with GraphQL subscription is that we can't serialize message before broadcasting it to Group of subscribers. Each subscriber might use different GraphQL query so we don't know how to serialize instance in advance.

See related issue

@dfee
dfee / graphene_subscription.py
Created November 25, 2017 03:17
Example of how subscriptions work with graphene
from collections import OrderedDict
import graphene
import rx
subject = rx.subjects.Subject()
class Author(graphene.ObjectType):
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@samsch
samsch / server.js
Created February 1, 2017 15:09
Web socket server
const Server = require('ws').Server;
const https = require('https');
const express = require('express');
const app = express();
//Express static server stuff. This can be whatever you want, just an example of using Express.
app.use(express.static(path.join(__dirname, '../public')));
//`config` has the (absolute) paths to the files, and the desired port to run over.
@ydeshayes
ydeshayes / Setting scroll position with ReactJS
Last active November 16, 2021 15:42
Setting scroll position with ReactJS
// Edit from http://blog.vjeux.com/2013/javascript/scroll-position-with-react.html
componentDidMount() {
const node = ReactDOM.findDOMNode(this);
node.scrollTop = node.scrollHeight;
}
componentWillUpdate: function() {
const node = this.getDOMNode();
this.shouldScrollBottom = node.scrollTop + node.offsetHeight === node.scrollHeight;
},
@eagletmt
eagletmt / ghc_complete.vim
Created July 25, 2010 03:25
This plugin is currently maintained here: https://github.com/ujihisa/neco-ghc
" plugin for neocomplcache <http://github.com/Shougo/neocomplcache>
"
" This plugin requires ghc-mod <http://www.mew.org/~kazu/proj/ghc-mod/>
let s:source = {
\ 'name' : 'ghc_complete',
\ 'kind' : 'ftplugin',
\ 'filetypes': { 'haskell': 1 },
\ }