Skip to content

Instantly share code, notes, and snippets.

@pajp
pajp / disable-oas.sh
Created June 12, 2011 16:02
Disable real-time scanning on F-Secure Anti-Virus for Mac
#!/bin/sh -e
# Running this script will disable the on-access (real-time) scanner in F-Secure Anti-Virus for Mac
# while preserving the ability to use the on-demand (manual) scanner.
#
# Note that this *will* make the UI persistently tell you that there is a problem with real-time
# scanning. Which is true, because you disabled it. :-)
#
# NOTE THAT THIS WILL MAKE YOUR COMPUTER UNPROTECTED. DO THIS AT YOUR OWN RISK!
# NOTE THAT THIS WILL MAKE A BACKUP COPY IN YOUR "Documents" FOLDER. KEEP IT.
# NOTE THAT THIS IS AN UNSUPPORTED HACK. IT MAY STOP WORKING AT ANY TIME.
@billwscott
billwscott / gist:3151596
Created July 20, 2012 16:08 — forked from jeffharrell/gist:3134368
The one page PayPal Express Checkout guide (using cURL)

One page PayPal Express Checkout guide using cURL

To integrate with Express Checkout have your API credentials ready and read on.

Step 1 - Send your transaction data to PayPal (your API credentials are required for safety):

@thody
thody / JdbiIntegrationTest.java
Last active December 18, 2015 12:19
Starting point for an abstract base class for Dropwizard JDBI integration tests.
public abstract class JdbiIntegrationTest {
private DBI dbi;
private Handle handle;
private Liquibase liquibase;
protected abstract DatabaseConfiguration getDatabaseConfiguration();
@zxbodya
zxbodya / S3-CORS-config.xml
Last active April 6, 2024 03:40
Client side uploads to s3, with pre-signed upload form (PHP/JS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
@ctford
ctford / intro.clj
Last active February 4, 2016 15:19
Clojure introduction
; Why Clojure?
;
; * Interactive
; * Succinct
; * Consistent
; * Java interoperability
; Try Clojure is an online "repl", where you can try out Clojure expressions.
; http://tryclj.com/
@runexec
runexec / clojure-transduce-reduce.md
Last active August 16, 2017 22:11
Clojure's Transducers and Reducers

Transducers and Reducers

Notes and examples of Transducers and Reducers

Reducers

  • Used on collections

  • Eager evaluation only. (not lazy)

@Deraen
Deraen / components.clj
Last active December 15, 2019 08:03
Compojure-api with Component
(ns foobar.components
(:require [com.stuartsierra.component :as component]
[compojure.api.sweet :refer :all]))
(defmethod compojure.api.meta/restructure-param :components
[_ components acc]
(update-in acc [:letks] into [components `(::components ~'+compojure-api-request+)]))
(defn wrap-components [handler components]
(fn [req]
(defrecord Server [service-map]
component/Lifecycle
(start [component]
(info :msg "Starting server.")
(let [server (bootstrap/create-server (:service-map service-map))]
(bootstrap/start server)
(assoc component :server server)))
(stop [component]
(info :msg "Stopping server.")
(update-in component [:server] bootstrap/stop)))
@shrayasr
shrayasr / bulk-insert-sa.md
Last active December 11, 2020 16:04
Bulk Inserts via SQLAlchemy and Flask-SQLAlchemy

Bulk Inserts via SQLAlchemy and Flask-SQLAlchemy

Problem

I ran into an issue today where I had to perform a bulk insert into a postgres DB. I was already using SQLAlchemy and Flask-SQLAlchemy to manage the connections to the db and I didn't want to have to use things like psycopg2 directly.

Solution

Note: SQLAlchemy provides an ORM. It isn't just an ORM. That is an important thing to be kept in mind. This means that you can bypass choose to not use the ORM layer when you don't want it. The idea with an ORM is to track changes to objects and when you have a case like that is when you'd use the ORM. In a bulk upload scenario, you don't need to track changes to objects. All you care is that everything be pushed into the DB.

@msgodf
msgodf / intro-clojure.org
Created March 19, 2015 16:18
Clojure intro

Intro to Clojure

Overview

First three hours of Clojure.

Small (~3 people) group, Java experience, some Javascript and other dynamic language experience - no prior Clojure knowledge is assumed.

What can you learn?