Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

depicus Depicus

🏠
Working from home
View GitHub Profile
View Creating A Raspberry Pi Card
Download image from https://www.raspberrypi.org/downloads/raspbian/
Create filesysstem with https://www.balena.io/etcher/
Create a file called SSH in the root of the drive
Create a file called wpa_supplicant.conf in the root and add the following
country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant
@Depicus
Depicus / java to slack.java
Created Dec 26, 2014
Sending Slack hook from Java
View java to slack.java
private static void sendSlackMessage(String message)
{
String url = "https://hooks.slack.com/services/your-token-here";
HttpClient client = new HttpClient();
PostMethod post = new PostMethod(url);
JSONObject json = new JSONObject();
try {
json.put("channel", "#general");
json.put("text", message);
json.put("username", "#java-error-bot");
@Depicus
Depicus / UpdateToStretch.sh
Last active Apr 29, 2019
Upgrade Raspberry Pi from Jessie to Stretch
View UpdateToStretch.sh
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list
sudo sed -i /deb/s/jessie/stretch/g /etc/apt/sources.list.d/*.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo apt-get autoclean
View Securing Wordpress
sudo apt update
sudo apt-get install software-properties-common
sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot python-certbot-apache
sudo certbot certonly --manual --preferred-challenges dns -d wordpress.depicus.com
SSLCertificateFile /etc/letsencrypt/live/wordpress.depicus.com/fullchain.pem
@Depicus
Depicus / Installing Wordpress
Created Mar 20, 2019
Commands for installing Wordpress on Ubuntu 18.04 LTS
View Installing Wordpress
sudo apt update && sudo apt upgrade && sudo apt autoremove
cd /var/www
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xfz latest.tar.gz
sudo rm latest.tar.gz
sudo apt install php-mysql
View Installing Apache, PHP And MySQL Server
sudo apt install apache2 php mysql-server
sudo apt install postfix
# if you want to edit from the command line
sudo nano /usr/share/logwatch/default.conf/logwatch.conf
sudo nano /etc/logcheck/logcheck.conf
sudo nano /etc/logcheck/logcheck.logfiles
View Installing Ubuntu 18.4 Part One
sudo apt update && sudo apt upgrade && sudo apt autoremove
git clone http://github.com/depicus/scripts
cd scripts
sudo sh webmin.sh
@Depicus
Depicus / clean-windows-10.ps1
Last active Nov 28, 2017
Clean Windows 10 for the corporate environment.
View clean-windows-10.ps1
// 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
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
%>
@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 {