Skip to content

Instantly share code, notes, and snippets.

@zmajstor
zmajstor / ldap_test.rb
Last active April 16, 2021 08:25
LDAP test
# ---- edit data below ------------
LDAP_HOST = 'promdmnet.cloudapp.net'
LDAP_PORT = 636 # 636 or 389
LDAP_BASE = "dc=promdm, dc=net"
LDAP_BIND_USER = "[email protected]" # format is username@domain
LDAP_BIND_PASS = "ldapbindpassword"
samaccountname = "zm"
password = "userpassword"
# ----- edit end ------------------
@jeffjohnson9046
jeffjohnson9046 / ruby-ldap-sample.rb
Last active January 5, 2024 07:11
Some VERY basic LDAP interaction in Ruby using Net::LDAP.
#######################################################################################################################
# This Gist is some crib notes/tests/practice/whatever for talking to Active Directory via LDAP. The (surprisingly
# helpful) documentation for Net::LDAP can be found here: http://net-ldap.rubyforge.org/Net/LDAP.html
#######################################################################################################################
require 'rubygems'
require 'net/ldap'
#######################################################################################################################
# HELPER/UTILITY METHOD
@Guitsou
Guitsou / usb_auth.md
Last active August 7, 2020 07:53
Authentification avec le PAM USB : se connecter avec une clé USB, et verrouiller la session automatiquement... Tutorial Ubuntu 13.04 / LXDE Sources : http://doc.ubuntu-fr.org/tutoriel/pam-usb /

Installation des paquets

sudo apt-get update && sudo apt-get install libpam-usb pamusb-tools

Il est possible de compiler le paquet pour les distributions n'ayant pas de paquet...

Ajout de clés et utilisateurs

@willurd
willurd / web-servers.md
Last active May 16, 2025 23:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@Odaeus
Odaeus / application_controller.rb
Last active February 12, 2025 06:24
Alternative to Rails' sharing of instance variables between controller and views.
class ApplicationController < ActionController::Base
# Creates an accessor which is exposed to the view
def self.view_accessor(*names)
attr_accessor *names
helper_method *names
end
end
@virtualstaticvoid
virtualstaticvoid / iptables_rules.sh
Created June 14, 2011 08:58
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@sirupsen
sirupsen / README.md
Created October 15, 2010 15:23
Simple evented ChatServer in pure Ruby using network I/O with select(2).

Dependencies

Colored for chat colors

gem install colored

It has many comments since I tried to explain what is going on for less-experienced Ruby people.