Skip to content

Instantly share code, notes, and snippets.

View mapix's full-sized avatar

mapix mapix

View GitHub Profile
@kenmazaika
kenmazaika / server.scala
Created November 3, 2012 17:15
Jetty + Akka + Scala Basic Auth
package com.pandemic.recommendation_core.web
import akka.actor._
import akka.actor.Actor.actorOf
import akka.http._
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.ServletHolder
import org.eclipse.jetty.servlet.ServletContextHandler
import org.eclipse.jetty.http.security.Constraint;
import org.eclipse.jetty.http.security.Credential;
@takawitter
takawitter / ScalaJSR223Test.java
Last active March 12, 2021 10:38
The sample code to run scala via JSR223 API. I turn usejavacp option true at line 10. Unless that you have to use http://github.com/rjolly/jarlister to list classes in scala-library.jar into MANIFEST.MF of jar that contains this ScalaTest class. I use Scala-2.11.6 to run this code.
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import scala.tools.nsc.interpreter.IMain;
import scala.tools.nsc.settings.MutableSettings.BooleanSetting;
public class ScalaTest {
public static void main(String[] args) throws Exception{
ScriptEngine engine = new ScriptEngineManager().getEngineByName("scala");
((BooleanSetting)(((IMain)engine).settings().usejavacp())).value_$eq(true);
@jeremiahsnapp
jeremiahsnapp / MITM -SSL-Proxies.md
Last active November 14, 2023 07:48
Man In The Middle (MITM) SSL Proxies - Simple ways to see traffic between an SSL server and client in clear text.

HTTP(S) specific MITM SSL Proxies

mitmproxy

mitmproxy is an excellent console app written in Python.

It is easy to use on Linux and OS X.

Use brew install mitmproxy to install it on OS X.

@neomantra
neomantra / gethostbyname.lua
Created September 25, 2013 20:25
Exercising gethostbyname with LuaJIT FFI
#!/usr/bin/luajit
local ffi = require 'ffi'
ffi.cdef([[
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
@tonyseek
tonyseek / captcha.py
Created November 26, 2014 02:51
A example of wheezy.captcha
import random
from wheezy.captcha.image import captcha
from wheezy.captcha.image import background
from wheezy.captcha.image import curve
from wheezy.captcha.image import noise
from wheezy.captcha.image import smooth
from wheezy.captcha.image import text
from wheezy.captcha.image import offset
from wheezy.captcha.image import rotate
@touilleMan
touilleMan / SimpleHTTPServerWithUpload.py
Last active October 28, 2025 18:34 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload - Python3 version
#!/usr/bin/env python3
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
"""
{
"id": 1,
"title": "Spark Prometheus",
"originalTitle": "Spark Prometheus",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
@scottsb
scottsb / casesafe.sh
Last active January 16, 2024 08:47 — forked from Hais/workspace.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/casesafe}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.casesafe.dmg.sparseimage}"
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-60g}"
@alvarow
alvarow / lvm2-cheat.sh
Last active August 19, 2018 15:42
Linux LVM Cheat sheet
# creates an LVM under a single device
dd if=/dev/zero of=/dev/sdb bs=512 count=64
pvcreate /dev/sdb
pvs
vgcreate timeline /dev/sdb
lvcreate -n app -l 100%FREE timeline
mkfs.xfs -L APP /dev/timeline/app
echo '/dev/timeline/app /app xfs noatime 1 2' >> /etc/fstab
mkdir -p /app && mount /app
@Ma233
Ma233 / open_repo
Last active December 5, 2016 07:40
chmod a+x open_repo && cp ./open_repo $HOME/bin && git config --global alias.open '!open_repo'
#!/usr/bin/env python
# encoding: utf-8
import sys
import subprocess
def convert_git_url(git_url):
if git_url.startswith('git@'):
git_url = 'http://' + '/'.join(git_url[4:].split(':'))
return git_url