This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;;;;;;;;;;;;; | |
| ;; Org-mode ;; | |
| ;;;;;;;;;;;;;; | |
| (defun get-user-or-password-from-node (type) | |
| "Extract username or password from the current" | |
| (assert (member type '(user pass USER PASS))) | |
| ;; Probably superfluous, given the mode-specific bindings below | |
| (assert (eq (with-current-buffer (current-buffer) major-mode) 'org-mode)) | |
| (let ((item (org-entry-get nil "ITEM"))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* -*-bison-*- */ | |
| /* Simple wc implementation in Flex */ | |
| %option noyywrap | |
| int rows = 0, words = 0, chars = 0; | |
| %% | |
| \n rows++; | |
| [A-Za-z0-9]+ words++; chars += strlen(yytext); | |
| . chars++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; -*- scheme -*- | |
| (import :std/foreign) | |
| (export get-screen-size) | |
| (begin-ffi (get-screen-size) | |
| (c-declare "#include <sys/ioctl.h>") | |
| (c-declare "#include <stdio.h>") | |
| (c-declare "#include <unistd.h>") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Rob Pike's examples with Common Lisp ChanL | |
| ;; Based on "Go Concurrency Patterns" (https://talks.golang.org/2012/concurrency.slide) | |
| (ql:quickload :chanl) | |
| ;; Background call example | |
| ;; (chanl::pcall #'(lambda () (boring "Yello"))) | |
| ;; Running function in the background (p.16) | |
| (defun boring (msg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package csp | |
| type KVPair struct { | |
| k int | |
| v int | |
| } | |
| func Min(x, y int) int { | |
| if x < y { | |
| return x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM golang:1.11.10-alpine3.8 | |
| ENV CGO_ENABLED 0 | |
| ENV GOPATH /opt/go:$GOPATH | |
| ENV PATH /opt/go/bin:$PATH | |
| ADD . /opt/go/src/tutorial | |
| WORKDIR /opt/go/src/tutorial | |
| RUN apk add --no-cache git | |
| RUN go get github.com/derekparker/delve/cmd/dlv | |
| RUN go build -o tutorial tutorial.go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| // #define BUF_GROW_FACTOR 2 | |
| using namespace std; | |
| template <class T> | |
| class stack { | |
| T *buffer; | |
| int buf_size; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template <class T> | |
| class queue { | |
| T *buffer; | |
| int buf_size; | |
| int front_index; | |
| int back_index; | |
| int buf_grow_factor; | |
| void realloc() { | |
| T *tmp = new T[buf_size*buf_grow_factor]; | |
| int size = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package stack | |
| type StackIF interface { | |
| Push(el interface{}) | |
| Pop() interface{} | |
| Current() interface{} | |
| Size() int64 | |
| Empty() bool | |
| } |