Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
# https://gitorious.org/mles/mles/source/5c575ae60df0b483d079120c17881d29c3bca7b3:rst2bs.py
# http://grissiom.blogspot.in/2009/12/some-twist-on-blog.html
#
# Generate an HTML Snippet for BlogSpot from reStructuredText.
#
# Modified from Matthias Friedrich's script that
# Generate an HTML Snippet for WordPress Blogs from reStructuredText.
# http://unmaintainable.wordpress.com/2008/03/22/using-rst-with-wordpress/
#
#! /usr/bin/env python
# http://blog.mafr.de/2008/03/22/using-rst-with-wordpress/
# http://users.mafr.de/~matthias/misc/rst2wp
#
# Generate an HTML Snippet for WordPress Blogs from reStructuredText.
#
# This is a modification of the standard HTML writer that leaves out
# the header, the body tag, and several CSS classes that have no use
# in wordpress. What is left is an incomplete HTML document suitable
# for pasting into the WordPress online editor.
#!/bin/env python
# https://gitorious.org/mles/mles/source/5c575ae60df0b483d079120c17881d29c3bca7b3:sep.py
# http://grissiom.blogspot.in
import re
import os
from os import listdir, makedirs, rmdir, remove
from os.path import isdir, isfile, islink
joinp, splitp = os.path.join, os.path.split
from shutil import move, copy2
@zaxebo1
zaxebo1 / update-emacs-ppa.sh
Created October 23, 2015 00:49 — forked from DamienCassou/update-emacs-ppa.sh
Emacs-snapshot and emacs24 build script for Ubuntu PPA
#! /usr/bin/env bash
# Author: Damien Cassou
#
# This is the script I use to build Emacs packages for Ubuntu. These
# packages are uploaded to
# https://launchpad.net/~cassou/+archive/emacs/. Each package is
# either build from a Debian package or from
# http://emacs.naquadah.org/.
@zaxebo1
zaxebo1 / HaxeScript.hx
Created January 20, 2017 03:09 — forked from jasononeil/HaxeScript.hx
haxex, a short shell script that can be used so you have Haxe shell scripting
#!/usr/bin/haxex
// Run with "./HaxeScript.hx some args here"
class HaxeScript
{
public static function main()
{
trace('Hi, the following ${Sys.args().length} arguments were passed in:');
for (a in Sys.args())
setenv DEFAULT_WORKSPACE "default"
if ( $?WORKSPACE == 0 ) then
setenv WORKSPACE $DEFAULT_WORKSPACE
endif
# Define alias 'et' to connect to the proper Emacs server identified by EMACS_SEVER_NAME
setenv EDITOR "emacsclient -s $WORKSPACE -t -a ''"
alias et "$EDITOR"
# Create alias 'kill-emacs' to kill proper Emacs server.
@zaxebo1
zaxebo1 / build-cinnamon
Created February 13, 2017 22:15 — forked from j0057/build-cinnamon
builds cinnamon from source
#!/bin/bash -ex
# build everything or just what's on the command line
if [ $# -eq 0 ]; then
PKGS="cjs cinnamon-desktop cinnamon-translations cinnamon-session cinnamon-settings-daemon cinnamon-control-center muffin Cinnamon nemo cinnamon-screensaver"
else
PKGS="$*"
fi
for x in $PKGS; do
@zaxebo1
zaxebo1 / LList.as
Created August 8, 2017 22:53 — forked from inspirit/LList.as
Fast & Simple Dual Linked List
package ru.inspirit.asfeat.struct
{
/**
* Simple but fast Dual Linked List approach
* Core implementation idea grabbed from Linux Kernel C source
*
* @author Eugene Zatepyakin
*/
public final class LList
{
@zaxebo1
zaxebo1 / spw
Created September 16, 2017 07:20 — forked from jolros/spw
Shell script to open SigmaPlot 12 using wine by itself or with a file passed in as an argument. See: http://blog.jolros.com/post/71709752383/running-sigmaplot-as-a-mac-os-x-application-using-wine
#!/usr/bin/env bash
export WINEDEBUG=-all
WINE=/usr/local/bin/wine
SPW=$HOME/.wine/drive_c/Program\ Files/SigmaPlot/SPW12/Spw.exe
if [ -z "$1" ]; then
"$WINE" "$SPW" >& /dev/null &
else

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o