Skip to content

Instantly share code, notes, and snippets.

View ArnisL's full-sized avatar
🦊

Arnis Lapsa ArnisL

🦊
View GitHub Profile
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
@ArnisL
ArnisL / gist:9125183
Created February 20, 2014 23:04
patched vimux
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 February 20, 2014 23:00
custom oh-my-zsh af-magic theme
# 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 November 2, 2019 18:59
tmux 24 bit colour support
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 +++++
@ArnisL
ArnisL / gist:5450831
Created April 24, 2013 09:13
change_mac.sh
#!/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 January 17, 2013 11:00
patched reaver 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,
@ArnisL
ArnisL / lithp.rb
Created January 25, 2012 22:46 — forked from fogus/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 January 3, 2012 17:18
Asp.net mvc route testing
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
@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>
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>();
}