Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

depicus Depicus

🏠
Working from home
View GitHub Profile
View ad-fig9
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
View wol-for-asp-var
<%
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
%>
View wol-for-asp-html
<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>
@Depicus
Depicus / wol-for-asp
Last active Aug 29, 2015
Wake on Lan code for use in an ASP application
View wol-for-asp
<%
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
%>
@Depicus
Depicus / kill-stuck-java.java
Created Jan 14, 2015
Kill a java app that is stuck and over running.
View kill-stuck-java.java
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 / gumby-icons.css
Created Jan 13, 2015
Working (for me) copy of just the icon section for Gumby
View gumby-icons.css
@charset "UTF-8";
.icon-note.icon-left a:before, .icon-note.icon-right a:after { content: "\266a"; height: inherit; }
i.icon-note:before { content: "\266a"; height: inherit; }
.icon-note-beamed.icon-left a:before, .icon-note-beamed.icon-right a:after { content: "\266b"; height: inherit; }
i.icon-note-beamed:before { content: "\266b"; height: inherit; }
@Depicus
Depicus / logback.java
Created Jan 10, 2015
Snippet to set param in logback.xml
View logback.java
try {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator jc = new JoranConfigurator();
jc.setContext(context);
context.reset();
context.putProperty("WorkStationID", dateWeAreSendingFor);
ClassLoader loader = main.class.getClassLoader();
jc.doConfigure(loader.getResource("logback.xml"));
} catch (JoranException ex) {
logger.error("init logging failed", ex);
@Depicus
Depicus / iptables.sh
Last active Aug 29, 2015
iptables setup
View iptables.sh
sudo iptables -F
sudo iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
sudo iptables -A INPUT -i eth0 -j DROP
sudo apt-get install iptables-persistent -y
sudo dpkg-reconfigure iptables-persistent
@Depicus
Depicus / interfaces
Created Dec 26, 2014
Network config for Ubuntu servers because I can never remember :)
View interfaces
# The primary network interface
auto eth0
iface eth0 inet static
address 10.11.11.33
netmask 255.255.0.0
gateway 10.11.2.6
dns-nameservers 10.11.1.24 8.8.8.8
@Depicus
Depicus / gravatar.php
Created Dec 26, 2014
Use Gravatar avatars from php
View gravatar.php
<?php
$email = md5(strtolower("bob@example.com"));
$gravatar = "http://www.gravatar.com/avatar/$email?d=404&s=50";
$headers = get_headers($gravatar,1);
if (strpos($headers[0],'200')) echo "<img src='$gravatar' style='border-radius: 25px;'>"; // OK
else if (strpos($headers[0],'404')) echo "No Gravatar"; // Not found we could show a default image here
?>
You can’t perform that action at this time.