Skip to content

Instantly share code, notes, and snippets.

View mhahl's full-sized avatar
👁️‍🗨️
Oh, hi Mark!

Mark Hahl mhahl

👁️‍🗨️
Oh, hi Mark!
  • Canberra, Australia
View GitHub Profile
@unnitallman
unnitallman / gist:944011
Created April 27, 2011 10:11
sqlite with activerecord outside rails
require 'active_record'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => ":memory:"
)
@ericchen
ericchen / gist:2656869
Created May 11, 2012 01:04
receive data from one client and forward data to tcp server on remote
require 'rubygems'
require 'eventmachine'
require "socket"
module GwServer
# @server_socket = TCPSocket.open('127.0.0.1', 3000)
# @queue = []
class GwTcpClient < EventMachine::Connection
@equivalent
equivalent / README.md
Last active December 16, 2021 16:34
String "false" to_bool ... or how to convert Rails/SimpleForm radio buttons to boolean

This gist was writen in 2012 and it was solving specific problem in Rails & SimpleForm. Some fellow developers were pointing out this may be out dated concept. That's why I advise everyone to read comment section bellow to have a full grasp of alternative solutions

other sources that may be helpful to understand why this may not be best idea:

@juanje
juanje / Description.md
Last active November 30, 2023 19:29
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
#!/bin/ruby
######################################################
#
# Author: Mark Hahl
# Email: mark@deviateit.net
# Version: 0.0.0
#
# Firewall configuration script for gateway server,
# managing traffic and other rules.
#
#!/usr/bin/env ruby
require './app'
require 'eventmachine'
class FingerServer < EM::Connection
def receive_data(data)
data.strip!
if data =~ /\A\w+\z/
@fntlnz
fntlnz / i3wm-fedora.md
Last active July 8, 2021 01:31
i3wm fedora lightdm

Install i3

dnf install i3

Add exec i3 to xinitrc

echo "exec i3" > ~/.xinitrc
@yegorg
yegorg / readme.md
Created November 11, 2015 03:15 — forked from ashrithr/readme.md
Installing ELK on a single machine

Installing ELK (CentOS)

This is a short step-by-step guide on installing ElasticSearch LogStash and Kibana Stack on a CentOS environment to gather and analyze logs.

I. Install JDK

rpm -ivh https://dl.dropboxusercontent.com/u/5756075/jdk-7u45-linux-x64.rpm
@rafaeltuelho
rafaeltuelho / openshift-cheatsheet.md
Last active June 18, 2024 20:48
My Openshift Cheatsheet

My Openshift Cheatsheet

Project Quotes, Limits and Templates

  • Cluster Quota
oc create clusterquota env-qa \
    --project-label-selector environment=qa \
    --hard pods=10,services=5
    
oc create clusterquota user-qa \
@cws-khuntly
cws-khuntly / squid.conf
Created July 17, 2016 19:51
Squid config
#
# Recommended minimum configuration:
#
visible_hostname proxy.caspersbox.com
## add in basic authentication (pending ldap auth)
auth_param basic program /usr/lib/squid/squid_ldap_auth -b "dc=caspersbox,dc=com" -f "uid=%s" -D "uid=AppUser,ou=AppAdmins,organizationalUnitName=Service Accounts,organizationalUnitName=Users,organizationName=CWS US,dc=caspersbox,dc=com" -W /etc/squid/ldap_pass -h data.caspersbox.corp -p 10389
auth_param basic children 50
auth_param basic realm CWS Proxy Services
auth_param basic credentialsttl 90 minutes