Skip to content

Instantly share code, notes, and snippets.

Thomas Stachl tstachl

Block or report user

Report or block tstachl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tstachl /
Created Feb 20, 2018
After any changes to the SSH configuration the service needs to be restarted.
sudo service ssh restart
tstachl / sshd_config
Last active Feb 20, 2018
My sshd_config with Root and Password access diabled.
View sshd_config
# /etc/ssh/sshd_config
# ...
# Authentication
LoginGraceTime 120
PermitRootLogin no
StrictModes yes
# ...
tstachl /
Created Feb 20, 2018
Steps to set up SSH keys for a newly created user account on my VPS.
# create the directory for ssh
mkdir -p ~/.ssh
# make sure it's editable only for the current user
chmod 700 ~/.ssh
# create the authorized keys file
touch ~/.ssh/authorized_keys
# use your favorite editor to add the public key
vim ~/.ssh/authorized_keys
tstachl /
Created Feb 20, 2018
Steps I took to create a sudo user on my Digital Ocean Droplet (Ubuntu).
# SSH as root to your Digital Ocean Droplet
ssh root@[DROPLET_IP]
# create the new user
adduser example
# add new user to the sudo group
gpasswd -a example sudo
# logging in with the new user
su - example
tstachl / gist:2760221
Created May 21, 2012
Salesforce open Simple Dialog in custom button/link or on a visualforce page
View gist:2760221
// if you want to use it inside a visualforce page create a function around it
function showFollowUp() {
// if you want to use it in a button make sure you require jQuery
// get the dialog with your dialog name
var d = sfdcPage.dialogs['MyCoolDialog'], close;
if (!d) {
// if the dialog doesn't exist create one
d = sfdcPage.dialogs['MyCoolDialog'] = new SimpleDialog('MyCoolDialog', false);
// set general information on your dialog and finally run the create function
tstachl / api_content_type.rb
Created Aug 18, 2013
This is a simple Rack Middleware to set the request content type for specific routes. It checks if a content type is set and does not override the existing one. The options allow you to specify the request methods, path (with a string or a regular expression) and the content type to be set.
View api_content_type.rb
module Rack
class ApiContentType
def initialize(app, methods = [:post, :patch], path = /^\/api\/v2+/, content_type = 'application/json')
@app = app
@methods = (methods.is_a?(Array) ? methods : [methods]).map{ |item| item.to_s.upcase }
@path = path
@content_type = content_type
def call(env)
tstachl / export.rb
Created Dec 18, 2014
This is a very rudimentary script of exporting data from to a CSV file.
View export.rb
require 'desk_api'
require 'csv'
# Create the CSV files
cases ='./cases.csv', 'wb')
interactions ='./interactions.csv', 'wb')
# Add the headers to the CSV files
cases << ['Case #', 'Subject', 'Description', 'Status']
interactions << ['Case #', 'Body', 'Created Date']
tstachl / Client.cs
Created Aug 19, 2016 API Client for C#
View Client.cs
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.IO;
using System.Security.Cryptography;
namespace DeskApi
/// <summary>
View ApplyMacro
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" recordSetVar="macros" docType="html-5.0"
standardController="Macro__c" extensions="ApplyMacroControllerExtension" title="Select Macro" >
<apex:includeScript value=""/>
<apex:includeScript value="/support/console/30.0/integration.js"/>
<apex:includeScript value="/soap/ajax/30.0/connection.js"/>
<apex:includeScript value="/support/api/30.0/interaction.js"/>
<apex:includeScript value="/canvas/sdk/js/30.0/publisher.js"/>
<apex:stylesheet value="//" />
tstachl / desk_multipass.php
Last active Apr 23, 2017
WordPress - Multipass SSO Plugin
View desk_multipass.php
* Plugin Name: Multipass
* Plugin URI:
* Description: A WordPress plugin to add a menu option that redirects to your Support Site.
* Version: 1.0.0
* Author: Thomas Stachl
* Author URI:
* License: BSD 3-Clause License
You can’t perform that action at this time.