Skip to content

Instantly share code, notes, and snippets.

View mjradwin's full-sized avatar

Michael J. Radwin mjradwin

View GitHub Profile
@LukasCZ
LukasCZ / ComplicationController+helpers.swift
Created February 18, 2022 13:41
Helper methods for creating pixel-perfect complications for all Apple Watch sizes.
//
// ComplicationController+helpers.swift
// WatchKit Extension
//
// Created by Lukas Petr on 09.02.2022.
// Distributed under MIT License.
//
//
// Helper methods for creating pixel-perfect complications for all Apple Watch sizes.
# Example YAML to get you started quickly.
# Be aware that YAML has indentation based scoping.
# Code completion support is available so start typing for available options.
swagger: '2.0'
# This is your document metadata
info:
version: "1.0.0"
title: Hebcal API
description: Description something something
@yakovsh
yakovsh / 2005_06_03-remove_vowels_from_hebrew.js
Last active May 23, 2022 19:43
Removing Vowels from Hebrew Unicode Text
/*
* One of the questions that recently came up is how to remove vowels from Hebrew characters in Unicode
* (or any other similar language). A quick look at Hebrew Unicode chart shows that the vowels are all
* located between 0x0591 (1425) and 0x05C7 (1479). With this and Javascript's charCodeAt function, it
* is trivial to strip them out with Javascript as follows
*
* Live demo is available here:
* https://jsfiddle.net/js0ge7gn/
*/
@carlessanagustin
carlessanagustin / Debconf.md
Last active August 2, 2023 14:07
For unattended installations in Debian Linux environments
@mjradwin
mjradwin / winsorize-apache-spark.scala
Last active August 29, 2015 14:24
Winsorize an RDD of Doubles for Apache Spark
import org.apache.spark.rdd.RDD
def winsorize(data: RDD[Double], limits:(Double,Double)): RDD[Double] = {
val r = data.sortBy(x => x)
val c = r.count()
if (c <= 2) r
else {
val n0 = limits._1 * (c + 1d)
val n1 = limits._2 * (c + 1d)
val k0 = n0.toLong
@derekclee
derekclee / default.vcl
Last active July 15, 2022 09:52
Varnish Cache Set CORS headers
sub vcl_deliver {
if (req.url ~ "/fonts/") {
set resp.http.Access-Control-Allow-Origin = "*";
set resp.http.Access-Control-Allow-Methods = "GET, OPTIONS";
set resp.http.Access-Control-Allow-Headers = "Origin, Accept, Content-Type, X-Requested-With, X-CSRF-Token";
}
}

Quick install PHP 7.0:

1. Install depends PHP 7.0
$ brew install autoconf automake gmp homebrew/versions/bison27 gd freetype t1lib gettext zlib mcrypt
2. Configure PHP 7.0
$ git clone --depth=1 https://github.com/php/php-src.git

$ cd php-src

@mugli
mugli / README.md
Last active January 5, 2016 23:33
Using stud (The Scalable TLS Unwrapping Daemon) on Ubuntu 12.04

Using stud (The Scalable TLS Unwrapping Daemon) on Ubuntu 12.04

stud repo: https://github.com/bumptech/stud

###Compiling from source: stud on Ubuntu repository is outdated. Here's how to compile that from source:

  sudo apt-get install -y libev-dev libssl-dev git-core
  
  git clone git://github.com/bumptech/stud.git
@matt448
matt448 / slack_nagios.sh
Last active February 13, 2023 15:38
Script to post Nagios notifications into a Slack channel
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@garlandkr
garlandkr / varnishncsa.json
Last active June 10, 2022 15:48
JSON from varnishncsa
varnishncsa -F '{
"@source" => "unknown",
"@type" => "varnish",
"@fields" => {
"remote_addr"=>"%h",
"remote_user" => "%u",
"x_forwarded_for" => "%{X-Forwarded-For}i",
"hit_miss"=>" %{Varnish:hitmiss}x",
"body_bytes_sent"=>"%b",
"request_time"=>"%{Varnish:time_firstbyte}x",