Skip to content

Instantly share code, notes, and snippets.

View matterche's full-sized avatar

Matthias Erche matterche

View GitHub Profile
@matterche
matterche / .pystartup
Last active December 15, 2023 19:21
Enable Python REPL command history and tab completion
# Store this file in ~/.pystartup,
# set "export PYTHONSTARTUP=/home/user/.pystartup"
#
# Note that PYTHONSTARTUP does *not* expand "~", so you have to put in the
# full path to your home directory.
import atexit
import os
import readline
import rlcompleter
@matterche
matterche / requests
Last active August 29, 2015 14:23
Use https://github.com/kennethreitz/requests/ to send Json data to a server with self-signed SSL certificate
import requests
requests.packages.urllib3.disable_warnings()
r = requests.post('https://self-signed.cert/',json={"key": "value"}, verify=False)
r.status_code
@matterche
matterche / AccessLog.scala
Last active July 21, 2016 02:30
Simple access log for Play! 2.3.x app
package globals
import play.api.libs.concurrent.Execution.Implicits.defaultContext
import play.api.mvc.{Filter, RequestHeader, Result}
import scala.concurrent.Future
object AccessLog extends Filter {
override def apply(next: RequestHeader ⇒ Future[Result])(request: RequestHeader): Future[Result] = {
val start = System.currentTimeMillis()
@matterche
matterche / junit4-templates.xml
Created March 22, 2012 12:16 — forked from hstaudacher/junit4-templates.xml
JUnit4 Templates for Eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="setup">${:import(org.junit.Before)}
@Before
public void setUp() {
${cursor}
}</template><template autoinsert="true" context="java" deleted="false" description="" enabled="true" name="teardown">${:import(org.junit.After)}
@After
public void tearDown() {
${cursor}
}</template><template autoinsert="false" context="java-members" deleted="false" description="test method" enabled="true" id="org.eclipse.jdt.ui.templates.test" name="test">${:import(org.junit.Test)}
@Test