Skip to content

Instantly share code, notes, and snippets.

View greut's full-sized avatar
:shipit:
moving slowly and breaking things

Yoan Blanc greut

:shipit:
moving slowly and breaking things
View GitHub Profile
@greut
greut / deploy.sh
Created March 18, 2017 15:57
Deploying Django application
#!/bin/bash
#
# Usage: ssh <host> ./deploy.sh
#
set -xe
. ~/.bash_profile
cd www/app
. bin/activate
@greut
greut / views.py
Created March 18, 2017 15:46
One view, multiple lists.
from django.views.generic import ListView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import Game
class GameListView(LoginRequiredMixin, ListView):
template_name = "games.html"
model = Game
ordering = '-id'
@greut
greut / docker-compose.yml
Last active March 6, 2017 10:35
Simple local django setup with Docker.
version: '2'
volumes:
postgres_data:
services:
postgres:
image: postgres:9.6-alpine
environment:
- POSTGRES_USER=django
@greut
greut / accesspoint.md
Last active February 10, 2021 23:32
Laptop Access-Point with monitoring

Access Point

Setup

  • hostapd
  • dnsmasq
  • ntop
  • iptables

NetworkManager

@greut
greut / pythagora_tree.py
Last active March 1, 2017 08:58
Blender 3-D L-System
import bpy
from math import cos, sin, radians
grammaire = {
"A": "B[+A][-A][<A]>A",
"B": "BB"
}
def génération(word, depth):
@greut
greut / bug.py
Last active March 5, 2017 08:53
Does pygame have a bug or am I dummy?
import sys
import pygame
FPS = 30
WIDTH, HEIGHT = GEOMETRY = 420, 360
screen = pygame.display.set_mode(GEOMETRY)
pygame.display.set_caption('Bug')
blocks = (
public DocbookXMLCatalogResolver implements XMLEntityResolver {
// ...
public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier)
throws IOException, XNIException {
if (resourceIdentifier.getNamespace().equals("http://docbook.org/ns/docbook")) {
resourceIdentifier.setNamespace("http://docbook.org/xml/5.0/xsd/docbook.xsd");
}
XMLInputSource source = resolver.resolveEntity(resourceIdentifier);
if (resourceIdentifier.getNamespace().equals("http://docbook.org/xml/5.0/xsd/docbook.xsd")) {
resourceIdentifier.setNamespace("http://docbook.org/ns/docbook");
@greut
greut / api.py
Last active June 2, 2020 21:20
Revamped api.py (with test and 100% coverage)
"""
Slack Web API
=============
The `Slack Web API`_ let you communicate with Slack.
Usage:
------
The following example calls the ``api.test`` method which test whether your
@greut
greut / bot.py
Last active February 12, 2020 13:47
Sample asyncio bot for Slack
"""Sample Slack ping bot using asyncio and websockets."""
import asyncio
import json
import signal
import aiohttp
from config import DEBUG, TOKEN
import websockets
@greut
greut / vpn.sh
Created April 29, 2016 07:01
VPN connection and SMB folder connection script.
#!/bin/bash
USERNAME=yoan.blanc
GID=`id -g`
PASSWORD="************"
DIRS="ORG"
PID=openconnect.pid
echo "Welcome to HE-ARC"
echo ""