Skip to content

Instantly share code, notes, and snippets.

@Arcath
Arcath / vbs_installer.vbs
Last active August 29, 2015 13:56
A script to silently deploy software to domain when no MSI is available (Assumes silent install exists on EXE)
dim shell, DQ, MSI_store, vbsinstall_folder, path_to_exe, options, chkfile
' Constants
DQ = chr(34)
Set FSys = CreateObject("Scripting.FileSystemObject")
vbsinstall_folder = "C:\vbs_install\" 'path to store keys in
if Not Fsys.FolderExists(vbsinstall_folder) Then
Fsys.CreateFolder(vbsinstall_folder)
path = require 'path'
fs = require 'fs-plus'
temp = require 'temp'
describe 'Jekyll', ->
describe 'before Activation', ->
it 'should be in the packages list', ->
expect(atom.packages.loadedPackages["jekyll"]).toBeDefined()
@Arcath
Arcath / Microsoft.PowerShell_profile.ps1
Last active August 29, 2015 14:16
My Powershell Profile
# Set the Location to my Powershell FOlders
set-location c:\Code\Powershell
# Fix/Set the console size
$Shell = $Host.UI.RawUI
$size = $Shell.WindowSize
$size.width=150
$size.height=50
$Shell.WindowSize = $size
http_port 3128
hierarchy_stoplist cgi-bin ?
cache_mem 1024 MB
cache_dir aufs /squid_cache/cache 81920 16 256
maximum_object_size 5120 MB
cache_store_log /squid_cache/store.log
coredump_dir /var/spool/squid3
@Arcath
Arcath / player.rb
Created June 14, 2010 20:41
My Ruby-Warrior player.rb
class Player
Directions = [:left, :right, :forward, :backward]
FullHealth = 20
def full_health?
@warrior.health == FullHealth
end
def whats_out_there?
@Arcath
Arcath / gist:481321
Created July 19, 2010 12:19
gravatar avatar url generating helper method, simply pass an email to it
def gravatar_url(email,options = {})
require 'digest/md5'
hash = Digest::MD5.hexdigest(email)
url = "http://www.gravatar.com/avatar/#{hash}"
options.each do |option|
option == options.first ? url+="?" : url+="&"
key = option[0].to_s
value = option[1].to_s
url+=key + "=" + value
end
@Arcath
Arcath / gist:580440
Created September 15, 2010 08:43
gist embedding tag for tbbc
[/\[gist\](.*?)\[\/gist\]/,'<script src="http://gist.github.com/\1.js"> </script>',:code_enabled],
[/\[gist=(.*?)\](.*?)\[\/gist\]/,'<script src="http://gist.github.com/\2.js?file=\1"> </script>',:code_enabled]
@Arcath
Arcath / comments_controller.rb
Created October 17, 2010 08:03
Nested model create action using SpamHam
def create
@post = Post.find(params[:post_id]) if params[:post_id]
@post = Post.find(params[:comment][:post_id]) if params[:comment][:post_id]
@comment = @post.comments.new(params[:comment])
@comment.user_id = current_user.id if current_user
if @comment.body.spam? then
unless params[:recaptcha_challenge_field] then
flash[:error] = "Comment looks like Spam"
render :action => 'new'
else
@Arcath
Arcath / gist:705370
Created November 18, 2010 18:18
TrainBBCode Callback Demo
def up_handler(input)
input.upcase
end
>> "[up]HeLlo WorLd[/up]".tbbc(:custom_tags => [[/\[up\](.*?)\[\/up\]/,"Callback: up_handler",true]])
=> "HELLO WORLD"
@Arcath
Arcath / gist:888172
Created March 26, 2011 09:51
LDAP Omniauth session code (pre ldap improving)
def create
user = User.find_by_provider_and_uid("ldap",params[:username]) || User.create_with_omniauth("ldap",params[:username])
session[:user_id] = user.id
redirect_to "/pages/splash"
end