Skip to content

Instantly share code, notes, and snippets.

Giacomo Stelluti Scala gsscoder

Block or report user

Report or block gsscoder

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
gsscoder /
Last active Nov 16, 2019
Shell customizations
# common aliases
alias ll='ls -lha'
alias la='ls -A'
alias l='ls -CF'
# grep options
export GREP_OPTIONS="--color=always"
export GREP_COLOR="1;35;40"
# editor
gsscoder /
Last active Nov 16, 2019
Checks if terminal supports colors
def supports_color():
# Ripped from:
plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
return supported_platform and is_a_tty
gsscoder /
Last active Nov 16, 2019
Creates a list of cities in JSON
# file URL:
import csv
import re
cities = []
with open('largest-cities.csv') as f:
reader = csv.DictReader(f, delimiter=',')
for row in reader:
gsscoder /
Last active Nov 9, 2019
Script to turn languages code into part of a regex
# file URL:
buf = ''
with open('language-codes-3b2.csv') as csv:
data = csv.readlines()
for d in data[1:]:
langs = d.split(',')
buf += f'{langs[0].upper()}|{langs[1].upper()}|'
gsscoder / closure-conf.cs
Last active Nov 7, 2019
Illustrates how to configure an object using closures in C#
View closure-conf.cs
class Program
static void Main(string[] args)
var obj1 = new ToBeConfigured(with =>
gsscoder / RenameFixtureMethods.fs
Last active Nov 7, 2019
Simple F# program to rename my C# test fixture methods
View RenameFixtureMethods.fs
Description: Simple program to change naming conventions of my C# test fixtures.
Purpose: Learn F#!
Author: Giacomo Stelluti Scala
Created: 2013-01-28
open System
open System.IO
open System.Globalization
open System.Text
gsscoder / SimpleCmdLineApp.vb
Last active Nov 7, 2019
Simple Command Line Parser Library Console Application
View SimpleCmdLineApp.vb
' needs CommandLine.dll prior to
' for later versions: templates are up to date
Imports CommandLine
Imports CommandLine.Text
Imports System.Reflection
<Assembly: [AssemblyInformationalVersion]("")>
Friend Class ThisAssembly
Friend Shared Title As String = "VBNetTemplate"
Friend Shared Author As String = "Your Name Here"
Friend Shared Copyright As String = "Copyright (C) 2012 " + Author
View SimpleOwinApp.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using AppFunc = System.Func< // Call
System.Collections.Generic.IDictionary<string, object>, // Environment
System.Threading.Tasks.Task>; // Done
gsscoder / SurfSample1.cs
Last active Nov 7, 2019
Super-Simple HTTP Server, demonstrates use of (work in progress)
View SurfSample1.cs
* Toy HTTP Sample Server
* Giacomo Stelluti Scala (
* Demonstrates use of (work in progress).
* How to execute: Copy & paste, then add a reference to Surf.dll.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
gsscoder / PeekableStream.cs
Last active Nov 7, 2019
Peekable readonly .NET/C# stream, implemented for
View PeekableStream.cs
// PeekableReader is better ->
sealed class PeekableStream : Stream
public PeekableStream(Stream stream)
_stream = stream;
_peeked = new byte[16];
_peekedLength = 0;
You can’t perform that action at this time.