Skip to content

Instantly share code, notes, and snippets.

View Cynede's full-sized avatar
🕸️

ミーゼこちゃん Cynede

🕸️
View GitHub Profile
@Cynede
Cynede / unicode.fs
Last active December 15, 2015 17:59
F# Unicode operators
let ° msg = System.Console.WriteLine( msg.ToString() )
let ◄ = 5
let ★ x = x + ◄
let (-★-) x y = x + y
let © = "© 2013"
let ► =
fun x -> 2 + x
@Cynede
Cynede / gist:5534470
Last active December 17, 2015 02:18
It's not the same
let (/>) f a = f a
[1;2;3]
|> Seq.iter /> fun z -> printf "%d" z // works
[1;2;3]
|> Seq.iter <| fun z -> printf "%d" z // <- doesn't work
@Cynede
Cynede / gist:5625403
Created May 22, 2013 05:20
Scripting Sample
run_cmd = !(cmd, args, done) ->
spawn = require 'child_process' .spawn
child = spawn cmd, args
result = stdout: ''
child.stdout
..on \data !(buffer) -> result.stdout += buffer
..on \end !-> done result
<-! run_cmd \ls <[ ]>
console
@Cynede
Cynede / gist:5642069
Created May 24, 2013 08:18
I would like just tell Compile All The Source
let (/>) f a = f a
let source =
(new DirectoryInfo(".")).GetFiles()
|> Array.filter /> fun f -> ( f.Extension = ".fs"
|| f.Extension = ".fsx")
type Relations =
| opens = 0
| modules = 1
@Cynede
Cynede / gist:6020229
Last active December 19, 2015 21:29
set
{
if ((value < 0) && (value != -1))
{
throw new ArgumentOutOfRangeException("ReadTimeout", SR.GetString("ArgumentOutOfRange_Timeout"));
}
if (this._handle == null)
{
InternalResources.FileNotOpen();
}
unsafe {
object stream = typeof(SerialPort).GetField("internalSerialStream", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(serialPort);
var handle = (SafeFileHandle)stream.GetType().GetField("_handle", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(stream);
COMMTIMEOUTS communications_timeouts;
communications_timeouts.ReadIntervalTimeout =
communications_timeouts.ReadTotalTimeoutConstant =
communications_timeouts.ReadTotalTimeoutMultiplier =
communications_timeouts.WriteTotalTimeoutConstant =
communications_timeouts.WriteTotalTimeoutMultiplier =
int main() {
<:]<%};
<:]<%%>;
[:>{%>;
[:><%};
[:><%%>;
<:??)<%??>;
??(:>{??>;
return 0;
}
@aras-p
aras-p / preprocessor_fun.h
Last active October 9, 2025 17:55
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@Cynede
Cynede / gist:6412427
Created September 2, 2013 12:39
My first Vala porgram
public class Application : Gtk.Window {
public Application () {
this.title = "Zaebis";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
this.set_default_size (170, 70);
Gtk.Button button = new Gtk.Button.with_label ("Make everything zaebis");
this.add (button);
button.clicked.connect (() => {
button.label = "Everything is zaebis now";
@Cynede
Cynede / gist:6591917
Last active December 23, 2015 06:09
EAPI 5
inherit [ autotools-utils ]
DESCRIPTION "A toolkit to assist in profiling applications in a domain specific way"
HOMEPAGE "https://github.com/rib/UProf"
SRC_URI "https://github.com/rib/UProf/archive/${PV}.tar.gz -> ${P}.tar.gz"
SLOT 0
LICENSE [ GPL-2 ]