Skip to content

Instantly share code, notes, and snippets.

🖥️
C64/Amiga Scener/Coder

Uğur Özyılmazel vigo

🖥️
C64/Amiga Scener/Coder
View GitHub Profile
@JosephPecoraro
JosephPecoraro / gist:4069
Created Aug 5, 2008
Shell Execution in Ruby
View gist:4069
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Returns the result of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@tritonrc
tritonrc / ldap_admin.rb
Created Jan 17, 2011
Simple Sinatra based LDAP admin tool
View ldap_admin.rb
require 'rubygems'
require 'sinatra'
require 'net-ldap'
require 'digest/sha1'
require 'base64'
require 'haml'
LDAP_HOST = 'localhost'
ADMIN_DN = 'cn=admin,dc=company,dc=com'
@jacobian
jacobian / models.py
Created Feb 15, 2011
An example of using many-to-many "through" to augment m2m relationships. See http://www.quora.com/How-do-you-query-with-a-condition-on-a-ManyToMany-model-in-Django for context.
View models.py
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=200)
groups = models.ManyToManyField('Group', through='GroupMember', related_name='people')
class Meta:
ordering = ['name']
def __unicode__(self):
@shinzui
shinzui / tmux.conf
Created Mar 12, 2011 — forked from bryanl/tmux.conf
tmux.conf
View tmux.conf
# ~/.tmux.conf
#
# See the following files:
#
# /opt/local/share/doc/tmux/t-williams.conf
# /opt/local/share/doc/tmux/screen-keys.conf
# /opt/local/share/doc/tmux/vim-keys.conf
#
# URLs to read:
#
@hughsaunders
hughsaunders / LDAPRemoteUserBackend.py
Created Jun 23, 2011
Django RemoteUserBackend for REMOTE_USER authentication and LDAP authorisation
View LDAPRemoteUserBackend.py
# LDAP Remote User Backend for Django 1.3
# Hugh Saunders - hugh@wherenow.org
# Written for the Surgical Materials Testing Laboratory - http://smtl.co.uk
# 2011
from django.contrib.auth.backends import RemoteUserBackend
import settings as s
import ldap
class LDAPRemoteUserBackend(RemoteUserBackend):
@michiel
michiel / cors-nginx.conf
Created Jul 5, 2011
Wide-open CORS config for nginx
View cors-nginx.conf
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@armonge
armonge / fields.py
Created Jul 18, 2011
A Django custom modelfield, formfield and formwidget to select and save a set of geographic coordinates using Google Maps
View fields.py
class GoogleMapMarker(object):
def __init__(self, latitude, longitude):
self.latitude = latitude
self.longitude = longitude
def __unicode__(self):
return '%f,%f'%(self.latitude, self.longitude)
def __len__(self):
return len(self.__unicode__())
@panthomakos
panthomakos / group.rb
Created Sep 20, 2011
Custom Error Messages in Ruby
View group.rb
class Group
module Error
class Standard < StandardError; end
class AlreadyAMember < Standard
def message
"You are already a member of this group."
end
end
@brentertz
brentertz / rvm2rbenv.txt
Created Nov 21, 2011
Switch from RVM to RBENV
View rvm2rbenv.txt
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@fairchild
fairchild / Gemfile
Created Dec 7, 2011
An example sinatra omniauth client app
View Gemfile
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
You can’t perform that action at this time.