Skip to content

Instantly share code, notes, and snippets.

View marcusschiesser's full-sized avatar

Marcus Schiesser marcusschiesser

View GitHub Profile
@marcusschiesser
marcusschiesser / AuthFilter.scala
Created April 27, 2013 19:04
AuthFilter secures your Play 2.1.1 web application by allowing only requests that contain a secret access key. Once authenticated the secret key is stored in the session object for convenience.
package util
import play.api.mvc._
import play.api.Logger
object AuthFilter extends Filter {
val accessParam = "access_key"
val accessKey = "secret"
override def apply(next: RequestHeader => Result)(request: RequestHeader): Result = {
@marcusschiesser
marcusschiesser / HttpUtils.java
Created April 27, 2013 19:22
Simple Http client class for doing REST-style request with Android
import org.codehaus.jackson.map.ObjectMapper;
public class HttpUtils {
private static final int SERVER_PORT = 80;
private static final String SERVER_IP = "myapp.appspot.com"; // use 10.0.2.2 for emulator
private static HttpUtils instance = new HttpUtils();
private DefaultHttpClient client;
private ResponseHandler<String> responseHandler;
@marcusschiesser
marcusschiesser / TXUtils.java
Created April 27, 2013 19:26
Utils class for doing transactions with Google App Engine
public final class TXUtils {
public static final Logger log = Logger.getLogger(TXUtils.class.getName());
public interface Transaction<T> {
T doit(EntityManager em);
}
private static final EntityManagerFactory emfInstance = Persistence
.createEntityManagerFactory("my-persistence-unit");
@marcusschiesser
marcusschiesser / ext_dataview_buttons.js
Created May 7, 2013 08:10
Buttons with action handlers in a datagrid in ExtJS 4.2
Ext.onReady(function () {
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'}
]
});
var store = Ext.create('Ext.data.Store', {
@marcusschiesser
marcusschiesser / launchrock_adwords.js
Created September 22, 2016 17:34 — forked from anonymous/launchrock_adwords.js
Add Google Adwords to Launchrock
// you also have to add the JS from the URL http://www.googleadservices.com/pagead/conversion_async.js in the header,
// so the function window.google_trackConversion is available
angular.module("lrSiteApp").config(function ($httpProvider) {
var httpinterceptor = function () {
return {
response: function (result) {
var isCreateReq = result.config.url.match(/site-users\/create/) !== null;
if (isCreateReq) {
window.google_trackConversion({
@marcusschiesser
marcusschiesser / qt2gif.py
Created September 24, 2019 06:24
Convert QuickTime movies to animated GIFs. Useful for uploading to Github
from gooey import Gooey, GooeyParser
@Gooey(target="ffmpeg", program_name='QuickTime To Gif v1.0', suppress_gooey_flag=True)
def main():
parser = GooeyParser(description="Convert QuickTime movies to GIFs")
ffmpeg = parser.add_argument_group('Frame Extraction Util')
ffmpeg.add_argument('-i',
metavar='Input Movie',
help='The movie that you want to convert to a GIF',
widget='FileChooser')
@marcusschiesser
marcusschiesser / azure.zsh
Created October 24, 2019 10:38
Running latest Azure CLI via Docker
alias az='docker run -it -v ${HOME}/.azure:/root/.azure -v ${HOME}/.ssh:/root/.ssh --entrypoint "/usr/local/bin/az" microsoft/azure-cli:latest $@'
@marcusschiesser
marcusschiesser / index.jsx
Created November 23, 2021 10:53
Starter file to run any React app as a Splunk app
import React from 'react';
import ReactDOM from 'react-dom';
import { createStaticURL } from '@splunk/splunk-utils/url';
import $script from 'scriptjs';
function getLayoutApi(callback) {
const url = createStaticURL('build/api/layout.js');
if (window.requirejs) {
@marcusschiesser
marcusschiesser / DSTable.jsx
Created November 24, 2021 09:34
How to programmatically connect a search datasource to a Splunk visualization (without using the dashboard)
import React, { useState } from 'react';
import Table from '@splunk/visualizations/Table';
import { SplunkSearch } from '@splunk/datasources';
const DSTable = () => {
const [dsResult, setDsResult] = useState(null);
const ds = new SplunkSearch({
query: '| inputlookup example_kv',
queryParameters: {