Skip to content

Instantly share code, notes, and snippets.

View galdolber's full-sized avatar

Gal Dolber galdolber

View GitHub Profile
@aphyr
aphyr / gist:f72e72992dade4578232
Last active December 17, 2016 08:00
Clojure Keyword.intern
commit 8e51c34ca4d97e48750850d5ba09956f89783b4e
Author: Kyle Kingsbury <aphyr@aphyr.com>
Date: Wed May 7 19:06:15 2014 -0700
Improve Keyword.intern performance
Keyword interning is an expensive factor in many Clojure
serialization/deserialization paths, especially where the same set of
keywords are created and freed repeatedly; e.g. iterating over records
with similar structure. There are two principle costs to keyword
@maxweber
maxweber / query_check.clj
Created May 13, 2016 16:41
Checks if a Datomic datalog query contains only allowed symbols / functions.
(require '[datomic.api :as d]
'[clojure.string :as str])
(defn normalize-query
"Turns a vector formatted Datomic datalog query into a map formatted
one."
[query]
(let [pairs (partition-by keyword? query)]
(assert (even? (count pairs)))
(into
@azakordonets
azakordonets / simpleHttpServer.py
Created September 1, 2013 13:22
Python simple HTTP Server that get's two variables for launch - port and time delay( time after which server will return response) . If we do not specify this two values, then server starts on 8000 port with delay = 0
#!/usr/bin/env python
import SimpleHTTPServer, BaseHTTPServer, SocketServer, socket, time, sys
class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
BaseHTTPServer.HTTPServer) :
"""
New features w/r to BaseHTTPServer.HTTPServer:
- serves multiple requests simultaneously
- catches socket.timeout and socket.error exceptions (raised from
@Chouser
Chouser / externs_for_cljs.clj
Created June 17, 2013 13:44
Generate an externs.js file for arbitrary JS libraries for use in advanced Google Closure compilation, based on the ClojureScript code that uses the libraries.
(ns n01se.externs-for-cljs
(:require [clojure.java.io :as io]
[cljs.compiler :as comp]
[cljs.analyzer :as ana]))
(defn read-file [file]
(let [eof (Object.)]
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))]
(vec (take-while #(not= % eof)
(repeatedly #(read stream false eof)))))))
@hezi
hezi / HZClassUsingEnum.h
Created July 12, 2012 14:06
Objective-C Enum-TO-NSString and Vice versa.
// Declare enums like so:
#define IMAGE_STATUS(XX) \
XX(kDOImageStatusOK, = 0) \
XX(kDOImageStatusCached, )\
XX(kDOImageStatusRetry, )
DECLARE_ENUM(DOImageStatus, IMAGE_STATUS)
<?php
$captchaVerification = !empty($_REQUEST["captcha_verification"]) ? $_REQUEST["captcha_verification"] : false;
if ($captchaVerification !== false) {
$data = [
"endpoint" => "verify",
"captcha_verification" => $captchaVerification,
"captcha_difficulty" => 5 // make sure the difficulty matches the diffulty you added to form button
];
$options = [
"http" => [
var config = qz.configs.create("Epson TM88V");
// The QR data
var qr = 'https://qz.io';
// The dot size of the QR code
var dots = '\x09';
// Some proprietary size calculation
var size1 = String.fromCharCode(qr.length + 3);
@davybrion
davybrion / s1.c
Created September 3, 2012 18:20
code snippets for "Creating Remote TCP/IP Printer Ports From Code" post
BOOL WINAPI XcvData(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData,
PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus);
@brianreavis
brianreavis / libvips.sh
Created August 21, 2015 19:46
Install an exact version of libvips (an adaptation of Lovell Fuller's script)
#!/bin/sh
# Ensures libvips is installed and attempts to install it if not
# Currently supports:
# * Debian Linux
# * Debian 7, 8
# * Ubuntu 12.04, 14.04, 14.10, 15.04
# * Mint 13, 17
# * Red Hat Linux
# * RHEL/Centos/Scientific 6, 7
# * Fedora 21, 22
@esmcelroy
esmcelroy / _installing_simphony_2.10.md
Last active December 20, 2021 19:12
Installing Oracle/Micros Simphony 2.10

Preparing a Server for Simphony installation, and Installing Oracle/Micros Simphony 2.10

Prerequisites

The following is a list of prerequisites for the successful installation of Oracle Simphony POS 2.10:

  • Windows Server 2012 R2
  • The following IIS and .NET components:
    • NetFx4ServerFeatures
  • NetFx4