Skip to content

Instantly share code, notes, and snippets.

View flattener.rb
def flatten integers
[].tap do |memory|
integers.each do |element|
memory << element if element.is_a? Fixnum
next unless element.is_a? Array
flatten(element).each do |element|
memory << element if element.is_a? Fixnum
end
View gist:9125183
if exists("g:loaded_vimux") || &cp
finish
endif
let g:loaded_vimux = 1
command VimuxRunLastCommand :call VimuxRunLastCommand()
command VimuxCloseRunner :call VimuxCloseRunner()
command VimuxInspectRunner :call VimuxInspectRunner()
command VimuxScrollUpInspect :call VimuxScrollUpInspect()
command VimuxScrollDownInspect :call VimuxScrollDownInspect()
@ArnisL
ArnisL / gist:9125108
Created Feb 20, 2014
custom oh-my-zsh af-magic theme
View gist:9125108
# af-magic.zsh-theme
#
# Author: Andy Fleming
# URL: http://andyfleming.com/
# Repo: https://github.com/andyfleming/oh-my-zsh
# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
#
# Created on: June 19, 2012
# Last modified on: June 20, 2012
@ArnisL
ArnisL / tmux_24_bit_colours.c
Last active Nov 2, 2019
tmux 24 bit colour support
View tmux_24_bit_colours.c
From 9bc0f9402df5155065e4c31eed0e986b700df717 Mon Sep 17 00:00:00 2001
From: Arnis Lapsa <arnis.lapsa@gmail.com>
Date: Fri, 2 Aug 2013 16:15:46 +0300
Subject: [PATCH] 24bit colour support
---
colour.c | 6 ---
input.c | 30 +++++++++++++-
screen-write.c | 85 +++++++++++++++++++++++++++++++++++++-
tmux.h | 11 +++++
View gist:5450831
#!/bin/sh
clear
sudo service network-manager stop
NEW_MAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//; s/..:/00:/';`
sudo ifconfig wlan0 hw ether $NEW_MAC
sudo ifconfig mon0 down
sudo macchanger mon0 --mac=$NEW_MAC
sudo ifconfig mon0 up
sudo service network-manager start
@ArnisL
ArnisL / send.c
Created Jan 17, 2013
patched reaver send.c
View send.c
/*
* Reaver - Transmit functions
* Copyright (c) 2011, Tactical Network Solutions, Craig Heffner <cheffner@tacnetsol.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
View lithp.rb
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },
@ArnisL
ArnisL / ApplicationsFacts.cs
Created Jan 3, 2012
Asp.net mvc route testing
View ApplicationsFacts.cs
namespace Interreg.Integration.Web.Routing{
using Extensions;
using Interreg.Web.Controllers;
using Xunit;
public class ApplicationsFacts:Base{
[Fact]
public void Application(){
"~/Applications/1"
.ShouldMapTo<ApplicationsController>(c=>c.Application(null,null));
}
View gist:1416345
//view
@model StateIneligibilityModel
@Html.Js("ineligibilities/state")
@using (Html.BeginForm("State", "Ineligibilities", FormMethod.Post)){
<fieldset class="state-ineligibility">
<legend>State ineligibility:</legend>
@Html.HiddenFor(x=>x.Project)
<table>
<tr>
<td>@Html.LabelFor(x=>x.IneligibleCosts)</td>
View gist:1408454
public class Show{
public Show(DateTime startsOn, DateTime endsOn, string location, ShowType showType){
StartsOn = startsOn;
EndsOn = endsOn;
Location = location;
ShowType = showType;
Speakers = new List<Speaker>();
Attendees = new List<Attendee>();
AssociatedCampaigns = new List<Campaign>();
}