Skip to content

Instantly share code, notes, and snippets.

Adam Hoka ahoka

Block or report user

Report or block ahoka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ahoka
ahoka / c-include-guard.el
Created May 17, 2014
elisp function for generating header guards for C/C++ headers.
View c-include-guard.el
(defun c-include-guard ()
"Insert C header include guards."
(interactive)
(let (original-point macro-name)
(set 'original-point (point))
(set 'macro-name
(upcase
(replace-regexp-in-string
"\\."
"_"
View tipc.py
#!/usr/bin/env python
from socket import *
import umsgpack
s = socket(AF_TIPC, SOCK_RDM)
message = umsgpack.packb({ "version": 1, "command": "open"})
length = s.sendto(message, (TIPC_ADDR_NAME, 40000, 0, 0))
View rot90.sml
val m = [[1, 2, 3], [6, 5, 4]];
fun rot90 (matrix) =
let
fun rot90 (m, acc) =
if null (hd m) then
rev acc
else
rot90 (map tl m, map hd m :: acc)
in
View rot90.fs
let rot90 m =
let rec rot90 m acc =
if List.isEmpty <| List.head m then
List.rev acc
else
rot90 (List.map List.tail m) (List.map List.head m :: acc)
in
rot90 m []
let matrix = [[1; 2; 3;];
View dnsmasq_inventory.sh
#!/bin/sh
if [ "$1" = "--list" ]
then
echo "{"
echo " \"nodes\": {"
echo -n " \"hosts\": ["
first=1
for host in $(cut -d ' ' -f 3 /var/lib/libvirt/dnsmasq/default.leases)
do
View infix2.cc
#include <functional>
#include <iostream>
template <class A, class B, class C>
class Infix
{
private:
std::function<C(A, B)> funM;
public:
View .emacs.el
;;
;; .emacs file for c, c++, python development
;; Adam Hoka, 2016
;;
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
You can’t perform that action at this time.