Skip to content

Instantly share code, notes, and snippets.

@caiorss
caiorss / haddock.hs
Created February 15, 2017 00:11
A haddock cheat sheet because I'm incapable of remembering this shit.
{-|
Module : module documentation
Description : as;ldkjf
Copyright : >implying
License : >implying
Maintainer : lol
Stability : not
Portability : what
Module description here
@caiorss
caiorss / glibc-check.sh
Created February 13, 2017 16:25 — forked from fasterthanlime/glibc-check.sh
Prints the various glibc versions required by an executable
#!/bin/bash
# This scripts lets you check which minimum GLIBC version an executable requires.
# Simply run './glibc-check.sh path/to/your/binary'
#
# You can set `MAX_VER` however low you want, although I (fasterthanlime)
# feel like `2.13` is a good target (For reference, Ubuntu 12.04 has GLIBC 2.15)
MAX_VER=2.13
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
@caiorss
caiorss / List of languages that compile to JS.md
Created February 12, 2017 22:15
List of languages that compile to JS
@caiorss
caiorss / C# to F# 2.fs
Created January 21, 2017 05:17 — forked from nagat01/C# to F# 2.fs
My training.Translating C# code to F#.
(*
My training.Translating C# code to F#.
http://www.fincher.org/tips/Languages/csharp.shtml
*)
open System
open System.IO
open System.Net
@caiorss
caiorss / .ctags
Created January 21, 2017 03:58 — forked from tsdeng/.ctags
scala emacs
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/class \1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/object \1/o,objects/
--regex-scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/trait \1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/case class \1/m,case-classes/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/abstact class \1/a,abstract-classes/
--regex-Scala=/^[^\*\/]*def[ \t]*([a-zA-Z0-9_]+)[ \t]*.*[:=]/f \1/f,functions/
#--regex-Scala=/^[^\*\/]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
#--regex-Scala=/^[^\*\/]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@caiorss
caiorss / curl.md
Created January 18, 2017 19:44 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@caiorss
caiorss / SimpleHTTPServer.cs
Created January 13, 2017 03:29 — forked from aksakalli/SimpleHTTPServer.cs
SimpleHTTPServer in C#
// MIT License - Copyright (c) 2016 Can Güney Aksakalli
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
@caiorss
caiorss / XmlNamespaceStripper.cs
Created January 7, 2017 10:37 — forked from BlueReZZ/XmlNamespaceStripper.cs
Strip all namespaces from XML Document in C#
public class XmlStripper
{
public XmlNode RemoveAllNamespaces(XmlNode documentElement)
{
var xmlnsPattern = "\\s+xmlns\\s*(:\\w)?\\s*=\\s*\\\"(?<url>[^\\\"]*)\\\"";
var outerXml = documentElement.OuterXml;
var matchCol = Regex.Matches(outerXml, xmlnsPattern);
foreach (var match in matchCol)
outerXml = outerXml.Replace(match.ToString(), "");
@caiorss
caiorss / dictionary-app.el
Created January 5, 2017 13:37 — forked from daimatz/dictionary-app.el
Emacs Lisp Tips
;; Mac の Dictionary.app を、 Emacs の popwin.el から使う
;; dict.py is from http://sakito.jp/mac/dictionary.html
(defun dictionary ()
"dictionary.app"
(interactive)
(let ((word (if (and transient-mark-mode mark-active)
(buffer-substring-no-properties (region-beginning) (region-end))
(read-string "Dictionary: ")))
(cur-buffer (current-buffer))
(tmpbuf " * dict-process *"))
@caiorss
caiorss / ReflectionUtilities.cs
Created January 2, 2017 00:56 — forked from riyadparvez/ReflectionUtilities.cs
Reflection utilities for C#. Get all fields, constructors, methods and properties
/// <summary>
/// Utilties for reflection
/// </summary>
public static class ReflectionUtils
{
/// <summary>
/// Get all the fields of a class
/// </summary>
/// <param name="type">Type object of that class</param>
/// <returns></returns>