Skip to content

Instantly share code, notes, and snippets.

Avatar

ettis aptavout

View GitHub Profile
@aptavout
aptavout / natlog.for
Created Oct 21, 2014
Calculate natural logarithm
View natlog.for
c
c evaluate the natural logarithm e
c
c variables
c 123456 a
c fln the value of the natural logarithm
c iterm the current term in the summation
c next the next number in a factorial operation
c fdenom the value of the current factorial
c
@aptavout
aptavout / tree.c
Created Sep 23, 2014
Array-based tree traversal
View tree.c
/* demonstrate tree data structure with multi-dimensional arrays */
/* construct a tree of this form: */
/* 1 */
/* 2 3 */
/* 4 5 6 */
/* as a table, */
/* node children */
/* 1 2 3 */
/* 2 4 5 */
@aptavout
aptavout / putch.c
Created Sep 22, 2014
A fixed-length putchar()
View putch.c
#include <stdio.h>
#define MAXLINE 81 /* MAXLINE = MAXCARD + 1 */
#define MAXCARD 80
#define NEWLINE '\n'
#define BLANK ' '
static int putch_lastc = -1;
static char putch_buf[MAXLINE];
@aptavout
aptavout / getch.c
Last active Aug 29, 2015
One implementation of getchar()
View getch.c
#include <stdio.h>
#define MAXLINE 81 /* MAXLINE = MAXCARD + 1 */
#define MAXCARD 80
#define NEWLINE '\n'
#define BLANK ' '
static int getch_lastc = MAXLINE;
static char getch_buf[MAXLINE];
@aptavout
aptavout / tdbc::odbc standalone exe
Last active Aug 29, 2015
The Holy Grail of small-scale solutions
View tdbc::odbc standalone exe
# a Tcl script to automate builds
# instructions from http://wiki.tcl.tk/11861
# using tclkit.exe and sdx.kit from Google Code
# https://code.google.com/p/tclkit/downloads/list
# *** as well as TWAPI binaries ***
#
# Copy your source files into a work directory !!
#
# usage: tclsh this-script.tcl gui.tcl
#
@aptavout
aptavout / auto-pivot
Created Mar 12, 2014
Programmatic PivotTable using the VBA you already wrote (or recorded)
View auto-pivot
Const xlHTMLStatic = 0
Set args = Wscript.Arguments
Set objShell = CreateObject("Wscript.Shell")
htmPath = Wscript.Arguments.Item(0)
personalWb = objShell.ExpandEnvironmentStrings("%PERSONALWB%")
Set oXl = CreateObject("Excel.Application")
@aptavout
aptavout / eastward-sphere
Last active Aug 29, 2015
Windowed, threaded, double-buffered JFrame with Graphics2D text.
View eastward-sphere
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package lab;
import java.awt.*;
import javax.swing.JFrame;
View run-polink.bat
View run-pocc.bat
@echo off
setlocal
set winincludes=C:\Program Files\PellesC\Include\Win
set sysincludes=C:\Program Files\PellesC\Include
set INCLUDE=%winincludes%;%sysincludes%
rem /Ze: use Microsoft extensions to avoid winnt.h "No specific architecture" error
pocc sqlite.c /Ze
@aptavout
aptavout / iterate-2d.bas
Created May 24, 2013
Treat an Excel workbook as a 2-dimensional array, and iterate over it.
View iterate-2d.bas
Range("A1").Select
Range(ActiveCell, ActiveCell.CurrentRegion).Select
For Each row In Selection.Rows
Dim rowStr As String
For Each col In Selection.Columns
rowStr = rowStr & Cells(row.Row, col.Column)
If col.Column < Selection.Columns.Count Then
rowStr = rowStr & ","
You can’t perform that action at this time.