Skip to content

Instantly share code, notes, and snippets.

View flashpixx's full-sized avatar

Philipp Kraus flashpixx

View GitHub Profile
@rla
rla / code.pl
Last active May 31, 2018 11:35
Arouter http_daemon
:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_unix_daemon)).
:- use_module(prolog/arouter).
:- route_get(hello/Name, handle_hello(Name)).
handle_hello(Name):-
format('Content-Type: text/plain; charset=UTF-8~n~n'),
format('Hello ~w', [Name]).
@jgrodziski
jgrodziski / docker-aliases.sh
Last active April 30, 2024 17:46
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@wojteklu
wojteklu / clean_code.md
Last active May 3, 2024 08:55
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@ehdez73
ehdez73 / DemoApplication.java
Last active March 8, 2024 19:54
Create Beans programatically with Spring Boot
package com.example;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@eliquious
eliquious / README.md
Created January 4, 2016 05:01
Golang OpenPGP examples

Building

go build -o goencrypt main.go

Generating Keys

@jeamland
jeamland / gist:11284662
Created April 25, 2014 10:20
Bluetooth LE on OS X via Python
import select
import socket
import sys
import objc
from PyObjCTools import AppHelper
objc.loadBundle("CoreBluetooth", globals(),
bundle_path=objc.pathForFramework(u'/System/Library/Frameworks/IOBluetooth.framework/Versions/A/Frameworks/CoreBluetooth.framework'))
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active April 17, 2024 12:35
Using Git with Subversion Mirroring for WordPress Plugin Development
@hauspie
hauspie / git-log-to-tikz.rb
Created April 16, 2012 09:20
Extract git history to tikz picture
#!/usr/bin/env ruby
# A small ruby script to extract a git history to a tikz picture
# Author: Michael Hauspie <Michael.Hauspie@lifl.fr>
#
# Not clean code, not always working well, but does its job in most of the cases I needed :)
# A commit object
class Commit
attr_accessor :hash
@taichi
taichi / AddressUtil.java
Created January 31, 2011 09:30
convert from IP address text presentation to InetSocketAddress
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @see <a href="http://tools.ietf.org/html/rfc4291">[RFC4291] IP Version 6
* Addressing Architecture</a>
* @see <a href="http://tools.ietf.org/html/rfc5952">[RFC5952] A Recommendation