Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gabehollombe
gabehollombe / a3update.py
Created April 9, 2022 09:11 — forked from marceldev89/a3update.py
Arma 3 Linux server and mod updater (workshop)
#!/usr/bin/python3
# MIT License
#
# Copyright (c) 2017 Marcel de Vries
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Here's a repro:
1. Visit https://nycdemo152.auth.us-east-1.amazoncognito.com/login?response_type=token&client_id=1o72223p0ont9u6ctbdus5svsu&redirect_uri=https://aws.amazon.com/cognito/
2. Click on 'Continue with Facebook'
#! /usr/bin/env ruby
require 'curses'
include Curses
include Curses::Key
class Fixnum
def clamp(low, high)
v = self
v = low if self < low
@gabehollombe
gabehollombe / Main.elm
Created July 26, 2016 08:04
Example solution for Exercises from the Elm guide chapter on Forms
module Main exposing (..)
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
import List exposing (..)
import String exposing (..)
import Char exposing (..)
@gabehollombe
gabehollombe / fizzbuzz_without_conditionals.clj
Created July 29, 2015 12:05
FizzBuzz without conditionals
(defn fizz-buzz-n
[n]
(or
(and (zero? (mod n 15)) "FizzBuzz")
(and (zero? (mod n 3)) "Fizz")
(and (zero? (mod n 5)) "Buzz")
n))
(println (clojure.string/join "\n"
(->> (take 25 (iterate inc 1))
require 'ostruct'
def thing
OpenStruct.new(foo: 'FOO')
end
context 'foo' do
it 'returns foo' do
expect(thing.foo).to eq('FOO')
end
@gabehollombe
gabehollombe / gist:3c08b0b217b80c2c6467
Last active August 29, 2015 14:09
Spin up an in-memory Hadoop / HDFS instance
# Substitute path/version of hadoop files below
# Note: this will create a directory ./build/test/data/dfs/ to store your HDFS file system in. Clean this up when you're done.
HADOOP_CLASSPATH=/usr/local/Cellar/hadoop/2.4.0/libexec/share/hadoop/yarn/test/hadoop-yarn-server-tests-2.4.0-tests.jar hadoop jar /usr/local/Cellar/hadoop/2.4.0/libexec/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.4.0-tests.jar minicluster --nnport=8020
@gabehollombe
gabehollombe / gist:7854417
Last active February 2, 2020 12:34
Clojure from the Ground Up - Sequences - Exercises My answers to the exercises from: http://aphyr.com/posts/304-clojure-from-the-ground-up-sequences
; Sequences
;--------------------------------------------------
; Write a function to find out if a string is a palindrome–that is, if it looks the same forwards and backwards.
(defn revStr
"Reverses s and returns as a string"
[s]
(apply str (reverse s)))
(defn palindrome?
@gabehollombe
gabehollombe / similar_lines.rb
Created December 6, 2013 01:26
A simple Ruby script to calculate the percentage of similar lines between files. Useful for seeing duplicated lines in rails view files, for example.
# Show the percentage of similar lines between files.
# Requires: diffy gem
# Usage: Edit line 33 to match the files you're interested in, then run this script.
require 'rubygems'
require 'diffy'
def get_dup_lines_percentage(file1, file2)
starts_with_minus = /^-.*/
@gabehollombe
gabehollombe / .vimrc
Created November 19, 2013 12:56
Simple function to zoom Vimux's runner pane to fullscreen from Vim.
" If you use Vim, and tmux, you should be using Vimux: https://github.com/benmills/vimux
" This snippet will let you easily zoom Vimux's runner pane to fullscreen.
" It's really helpful for seeing more of a stack trace.
" Requires tmux >= 1.8
" Function to tell Vimux to have make tmux zoom its runner pane.
function! VimuxZoomRunner()
call VimuxInspectRunner()
call system("tmux resize-pane -Z")
endfunction