Skip to content

Instantly share code, notes, and snippets.

@vivkin
vivkin / myfire.py
Created March 11, 2017 18:05
google/python-fire in 30 seconds
from __future__ import print_function
import sys
class Calculator(object):
"""A simple calculator class."""
def double(self, number):
return 2 * number
if __name__ == '__main__':
@vivkin
vivkin / showaddrinfo.c
Created May 23, 2017 23:38
show getaddrinfo(3) results
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char **argv) {
@vivkin
vivkin / 16-color-table.sh
Created May 26, 2017 07:11
Terminal color test scripts
#!/bin/bash
#
# This file echoes a bunch of color codes to the terminal to demonstrate
# what's available. Each line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a test use of that color
# on all nine background colors (default + 8 escapes).
#
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m 44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' ' 36m' '1;36m' ' 37m' '1;37m';
@vivkin
vivkin / colors.h
Created September 4, 2017 09:57
Color schemes and palette for use in C
#pragma once
// https://yeun.github.io/open-color/
enum oc_names {
oc_gray,
oc_red,
oc_pink,
oc_grape,
oc_violet,
// generated by quake, do not modify
unbindall
bind TAB "+scores"
bind ENTER "+button2"
bind ESCAPE "togglemenu"
bind SPACE "+moveup"
bind + "sizeup"
bind - "sizedown"
bind / "weapnext"
bind 0 "weapon 10"
logic.script "API_LoadNavigationData('Resources/missions/LV_Karhad_PvE_Caravanserai_Navigation.json')"
logic.script "for i = 0, 30 do API_SpawnBot({x=1,y=1,z=1},0,'TaurusRPG',-1) end"