Skip to content

Instantly share code, notes, and snippets.

View xanthalas's full-sized avatar

Xanthalas xanthalas

  • Cambridge, England
View GitHub Profile
@xanthalas
xanthalas / editwithexistingvim.bat
Created December 5, 2016 12:09
Batch file to allow associated files in Windows to be opened with existing instance of VIM
c:\vim\vim80\gvim.exe --remote-silent %1
@xanthalas
xanthalas / .tmux.conf
Last active November 6, 2019 14:22
Tmux configuration file
bind-key r source-file ~/.tmux.conf \; display "Reloaded configuration file"
#set-option -g prefix2 `
unbind-key C-b
set -g prefix C-a
bind-key C-a send-prefix
#Split panes using - and |
bind | split-window -h
bind \ split-window -h
@xanthalas
xanthalas / CopyPathToClipboard.ps1
Created August 26, 2016 11:09
Powershell script to copy the current path to the clipboard
$a = pwd
Set-Clipboard -Value $a
@xanthalas
xanthalas / mycommits.rb
Created January 16, 2015 11:57
Retrieve log of recent subversion commits for given user
##########################################################################################
# Program: mycommits #
# Author : Xanthalas #
# : Retrieves all the commit messages from the repository referenced in the #
# : mycommits.ini file. #
##########################################################################################
def parseMessages(messages, user)
output = Array.[]
@xanthalas
xanthalas / GetInternalIP.rb
Created May 27, 2014 13:38
Get Internal IP Address and write to file
#!/usr/bin/ruby
#Retrieve the internal IP address (using IPCONFIG in Windows), display it to the console and write it to a file.
#binding.pry
def get_address
toFile = ARGV[0] + '\current_ip'
command = 'ipconfig'
output = `#{command}`
@xanthalas
xanthalas / gist:4663420
Created January 29, 2013 10:45
Ruby script to allow the user to choose the world they wish to use with their Minecraft server. It will update the server.properties file accordingly.
#############################################################################
# Minecraft server world selector. #
# Author: Xanthalas Date: May 2011 #
#############################################################################
puts "Minecraft server world selector"
puts ""
puts "Available worlds:"
puts ""
@xanthalas
xanthalas / Vimtips
Last active May 24, 2017 11:15
Vim Tips
VIM Tips:
Vim command to seperate filenames copied from Winmerge onto individual line
---------------------------------------------------------------------------
\(\..\{3,4}\)
Append String to every line in a selection
------------------------------------------
@xanthalas
xanthalas / Last_Time_Table_Accessed.sql
Created October 30, 2012 09:05
List tables in the database with the date and time they were last accessed - SQL Server
WITH LastActivity (ObjectID, LastAction) AS
(
SELECT object_id AS TableName,
last_user_seek as LastAction
FROM sys.dm_db_index_usage_stats u
WHERE database_id = db_id(db_name())
UNION
SELECT object_id AS TableName,
last_user_scan as LastAction
FROM sys.dm_db_index_usage_stats u
@xanthalas
xanthalas / getip.rb
Created September 26, 2012 21:05
Ruby script to retrieve external ip and upload details of it to an FTP server
#!/usr/bin/ruby
require 'net/ftp'
#Retrieve the external IP address, display it to the console and upload it to a web site
ip = `curl --silent --get http://automation.whatismyip.com/n09230945.asp`
print "IP Address: #{ip}\n\n"
time = Time.new
@xanthalas
xanthalas / togglelock.rb
Created October 26, 2011 09:09
Ruby script to toggle the Windows Lock facility on and off
#Toggles the registry value of the Windows Lock facility (Win+L)
require 'win32/registry'
current_key = 999
action = ""
Win32::Registry::HKEY_CURRENT_USER.open('Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System') do |reg|
current_key = reg['DisableLockWorkStation']
end