Skip to content

Instantly share code, notes, and snippets.

View aflag's full-sized avatar

Rafael C. de Almeida aflag

View GitHub Profile
package main
import (
"fmt"
"time"
)
type field struct {
name string
}
import Data.List
data BloodType = BloodA | BloodB | BloodAB | BloodO deriving (Eq, Show)
data Gene = A | B | O deriving (Eq, Show, Ord)
type Genes = [Gene]
allGenes = [A, B, O]
possibleGenesByBlood :: BloodType -> [Genes]
possibleGenesByBlood BloodA = [[A, O], [A, A]]
{
"title": "Interatividade",
"services": {
"query": {
"list": {
"0": {
"id": 0,
"type": "topN",
"query": "*",
"alias": "",
nextPos :: Grid -> Movement -> (Int, Int) -> (Int, Int)
nextPos grid GoLeft (x,y)
| inRange (bounds grid) (x-1,y) = (x-1,y)
| otherwise = (x,y)
nextPos grid GoRight (x,y)
| inRange (bounds grid) (x+1,y) = (x+1,y)
| otherwise = (x,y)
nextPos grid GoUp (x,y)
| inRange (bounds grid) (x,y+1) = (x,y+1)
| otherwise = (x,y)
import java.util.List;
import java.util.Iterator;
import java.util.LinkedList;
class ListAlgorithms {
private static <T extends Comparable<T>> void insert(T v, List<T> list) {
int i = 0;
for (T curr : list) {
if (curr.compareTo(v) == 1) break;
++i;
@aflag
aflag / gist:0f76c0fe0eee2bd2c38c
Created June 29, 2015 02:34
kubectl get service hello -o yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2015-06-29T02:33:28Z
labels:
name: hello
name: hello
namespace: default
resourceVersion: "135"
selfLink: /api/v1/namespaces/default/services/hello
-- Logs begin at Tue 2015-02-24 15:27:58 UTC, end at Mon 2015-06-29 02:41:45 UTC. --
Jun 29 02:28:46 kubernetes-minion-1 systemd[1]: Starting Kubernetes Kube-Proxy Server...
Jun 29 02:28:46 kubernetes-minion-1 systemd[1]: Started Kubernetes Kube-Proxy Server.
Jun 29 02:28:46 kubernetes-minion-1 kube-proxy[3364]: I0629 02:28:46.900283 3364 server.go:88] Running in resource-only container "/kube-proxy"
Jun 29 02:28:46 kubernetes-minion-1 kube-proxy[3364]: I0629 02:28:46.904727 3364 proxier.go:121] Setting proxy IP to 10.0.2.15 and initializing iptables
Jun 29 02:28:47 kubernetes-minion-1 kube-proxy[3364]: E0629 02:28:47.212576 3364 api.go:108] Unable to load services: Get https://10.245.1.2:6443/api/v1/services: x509: certificate signed by unknown authority
Jun 29 02:28:47 kubernetes-minion-1 kube-proxy[3364]: E0629 02:28:47.213223 3364 api.go:180] Unable to load endpoints: Get https://10.245.1.2:6443/api/v1/endpoints: x509: certificate signed by unknown authority
Jun 29 02:30:07 kubernetes-minion-1
package main
import (
"fmt"
)
type A struct {
}
func (a *A) Magic() {
@aflag
aflag / Output
Last active August 29, 2015 14:24
0x7ffeb58bf080 1
1 13
@aflag
aflag / gist:3483759
Created August 26, 2012 21:40
How to make tournament visible inside of code ...?
(define-syntax (define-action-with-tournament stx)
(syntax-case stx ()
((_ action-name code ...)
#'(define (action-name request id)
(let ((tournament (tournament/find id)))
(if tournament
(begin code ...)
(v/not-found)))))))