Skip to content

Instantly share code, notes, and snippets.

View seandenigris's full-sized avatar

Sean DeNigris seandenigris

View GitHub Profile
@seandenigris
seandenigris / install_debian.sh
Last active February 11, 2024 01:31
VirtualBox: Programmatically Create Debian VM
#!/bin/bash
# Reference: http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html
VM_NAME="Debian Squeeze 2"
DEBIAN_CD_IMAGE="debian-6.0.7-amd64-netinst.iso"
# Create VM
VBoxManage createvm --name "$VM_NAME" --ostype Debian_64 --register
# VM Settings
@seandenigris
seandenigris / gist:1430706
Created December 4, 2011 17:07
Pharo Smalltalk: Access Environment Variables
OSProcess thisOSProcess environment
%glr;
%prefix Le;
%root AnnotationParse;
%suffix Node;
%hierarchy Argument (
AlignmentArgument
CodeExpandedArgument
DbArgument
ExpandedArgument
@seandenigris
seandenigris / gt_slideshow_shortcuts.st
Last active June 24, 2021 01:32
GToolkit: Slideshow Shortcuts
shortcutBuilder := [ :world :key :action |
BlShortcutWithAction new
repeatable: false;
combination: (BlSingleKeyCombination new key: key);
action: [
| showElements |
showElements := world root allChildrenBreadthFirstSelect: [ :c | c isKindOf: GtSlideShowElement ].
showElements do: action ] ].
GtWorld allInstances do: [ :w |
@seandenigris
seandenigris / gist:4242432
Created December 8, 2012 23:01
Pharo Smalltalk TCP Server
"Adapted from http://www.slideshare.net/nourybouraqadi/pharo-networking-by-example
$! denotes the end of a message
"
| connectionSock interactSock request stream |
connectionSock := Socket newTCP.
[
connectionSock listenOn: 8888 backlogSize: 10.
interactSock := connectionSock waitForAcceptFor: 15.
stream := SocketStream on: interactSock.
@seandenigris
seandenigris / gist:dc8fc7dc6cd91e7bb3f327154814d2c9
Created September 30, 2020 17:31
Metacello Churn Transcript
Fetched -> BaselineOfTesseract-CompatibleUserName.1601486715 --- git@github.com:seandenigris/Tesseract-St.git[master] --- git@github.com:seandenigris/Tesseract-St.git[master]
Loaded -> BaselineOfTesseract-CompatibleUserName.1601486715 --- git@github.com:seandenigris/Tesseract-St.git[master] --- git@github.com:seandenigris/Tesseract-St.git[master]
Loading baseline of BaselineOfTesseract...
Fetched -> BaselineOfOSSubprocess-CompatibleUserName.1588868295 --- git@github.com:pharo-contributions/OSSubprocess.git[master] --- git@github.com:pharo-contributions/OSSubprocess.git[master]
Loaded -> BaselineOfOSSubprocess-CompatibleUserName.1588868295 --- git@github.com:pharo-contributions/OSSubprocess.git[master] --- git@github.com:pharo-contributions/OSSubprocess.git[master]
Fetched -> BaselineOfTempfile-CompatibleUserName.1600111301 --- git@github.com:seandenigris/TempfileSt.git[master] --- git@github.com:seandenigris/TempfileSt.git[master]
Loaded -> BaselineOfTempfile-CompatibleUserName.1600111301 --- git@github.com:s
@seandenigris
seandenigris / gist:1430993
Created December 4, 2011 18:59
Pharo Smalltalk: Quick and Dirty Serialization Example
"There are generally better ways (e.g. Ramon Leon's Simple Image-based Persistence), but this is as simple as it gets."
object := Morph new
color: Color white;
extent: 500@500.
serialized := object storeString.
(Compiler evaluate: serialized) openInWorld.
onsets := {
'14 March 2020'.
'17 March 2020'.
'18 March 2020'.
'19 March 2020'.
'16 March 2020'.
'20 March 2020'.
'21 March 2020'.
'18 March 2020'.
'21 March 2020'.
@seandenigris
seandenigris / gist:2604215
Created May 5, 2012 17:34
Pharo Smalltalk REPL server
"Works out of the box in Pharo 2.0. For prior versions (definitely works in 1.3 and 1.4), first file in https://gist.github.com/2602113"
| command |
[
command := FileStream stdin nextLine.
command ~= 'exit' ] whileTrue: [ | result |
result := Compiler evaluate: command.
FileStream stdout nextPutAll: result asString; lf ].
Smalltalk snapshot: false andQuit: true.
@seandenigris
seandenigris / gist:4981414
Last active January 9, 2020 10:23
Pharo: Dynamically Create a UI with Spec
"Requires at least the Spec version from Pharo 2.0"
| layout widget |
model := DynamicComposableModel new.
layout := SpecLayout composed.
layout newColumn: [ :col |
{1. 2. 3} do: [:e | | selector |
selector := ('accessorTo', e asString) asSymbol.
model instantiateModels: {selector. #TextInputFieldModel}.
widget := model perform: selector.