Skip to content

Instantly share code, notes, and snippets.

View Depicus's full-sized avatar
🏠
Working from home

Brian Slack Depicus

🏠
Working from home
View GitHub Profile
@Depicus
Depicus / kill-stuck-java.java
Created January 14, 2015 21:44
Kill a java app that is stuck and over running.
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
Thread t = new Thread(new Runnable() {
public void run() {
// stuff here that was in main
logger.debug("threaded started ");
try {
@Depicus
Depicus / wol-for-asp
Last active August 29, 2015 14:15
Wake on Lan code for use in an ASP application
<%
set WakeOnLan = server.createobject("DigitalWol.Wol")
WakeOnLan.TheMacAddress('009027a322fc')
WakeOnLan.TheIpNumber('217.204.255.61')
WakeOnLan.TheSubnetMask('255.255.255.255')
WakeOnLan.ThePortNumber('4343')
WakeOnLan.WakeMeUp
%>
<form method="post" action="bottom.asp" target="bottom">
<p align="justify" style="margin-left: 10">This is where you would enter the Mac Address.</p>
<input type="text" name="MacAddress" size="20" value="009027a322fc">
<input type="text" name="IpNumber" size="20" value="195.188.159.20">
<input type="text" name="SubnetMask" size="20" value="255.255.255.0">
<input type="submit" value="Send Magic Packet" name="thebutton" class="button">
</form>
<%
if Request.Form("MacAddress") <> "" then
set WakeOnLan = server.createobject("DigitalWol.Wol")
WakeOnLan.TheMacAddress(Request.Form("MacAddress"))
WakeOnLan.TheIpNumber(Request.Form("IpNumber"))
WakeOnLan.TheSubnetMask(Request.Form("SubnetMask"))
WakeOnLan.ThePortNumber(Request.Form("PortNumber"))
WakeOnLan.WakeMeUp
end if
%>
dn: CN=defaultPrinter,CN=Schema,CN=Configuration,DC=depicus,DC=com
changetype: add
adminDescription: Default-Printer
adminDisplayName: defaultPrinter
attributeID: 1.2.840.113556.1.8000.548.9460
attributeSecurityGUID:: hri1d0qU0RGuvQAA+ANnwQ==
attributeSyntax: 2.5.5.12
cn: defaultPrinter
isMemberOfPartialAttributeSet: TRUE
isSingleValued: TRUE
Sub ModifyUsers(ByVal TheObject)
Dim TheUser
For Each TheUser In TheObject
Select Case TheUser.Class
Case "user"
TheUser.Put("DefaultPrinter", "LDNLGHNPXXX")
TheUser.Setinfo()
Case "organizationalUnit", "container"
ModifyUsers(TheUser)
End Select
Option Explicit
Dim Args, TheUser, TheNewValue
Set Args = Wscript.Arguments
Set TheUser = GetObject(Args(0))
TheNewValue = InputBox("Old Default Printer: " & TheUser.defaultPrinter & vbCRLF & vbCRLF& vbCRLF& vbCRLF & "New Default Printer","Domain Default Printer",TheUser.defaultPrinter)
if TheNewValue <> "" then TheUser.Put "defaultPrinter",TheNewValue
TheUser.SetInfo
Set TheUser = Nothing
WScript.Quit
Option Explicit
Dim TheRoot, TheDisplay, TheContext, TheMenu, TheLoop, TheNewMenu
set TheRoot = Getobject(LDAP://RootDSE)
set TheContext = GetObject("LDAP://" & "CN=409, CN=DisplaySpecifiers," & TheRoot.get("configurationNamingContext"))
Set TheDisplay = TheContext.GetObject("displaySpecifier","cn=user-Display")
TheLoop = 0
If Not IsEmpty(TheDisplay.adminContextMenu) Then TheMenu = TheDisplay.GetEx("adminContextMenu")
For TheLoop = LBound(TheMenu) to UBound(TheMenu)
If InStr(TheMenu(TheLoop),"&Default Printer") Then
MsgBox "Menu already exists ... exiting ..."
@Depicus
Depicus / clean-windows-10.ps1
Last active November 28, 2017 12:00
Clean Windows 10 for the corporate environment.
// if you are on Windows 10 you may need to start powershell as admin and run the folowing command
// Set-ExecutionPolicy RemoteSigned (see https://technet.microsoft.com/library/hh847748.aspx)
// then set back after you are done with
// Set-ExecutionPolicy Undefined
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *zunemusic* | Remove-AppxPackage
@Depicus
Depicus / Installing Ubuntu 18.4 Part One
Last active March 2, 2019 19:19
Commands used in the YouTube video at https://youtu.be/oAGWXMY-5nM
sudo apt update && sudo apt upgrade && sudo apt autoremove
git clone http://github.com/depicus/scripts
cd scripts
sudo sh webmin.sh