Skip to content

Instantly share code, notes, and snippets.

Max Veytsman mveytsman

Block or report user

Report or block mveytsman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mveytsman
mveytsman / .bashrc
Last active Apr 11, 2019
Localtunnel replacement
View .bashrc
#hacky way to get a hosts ip
function ipfor() {
ping -c 1 $1 | grep -Eo -m 1 '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';
}
# localtunnel replacement (note that I default ssh to port 443 because thats how I roll
localtunnel() { if [ $# -lt 2 ]; then echo "Usage: localtunnel hostname port [ssh_port]"; else ssh_port=${3-443}; echo "Setting up localtunnel on `ipfor $1`"; ssh -N -R "*:0:localhost:$2" $1 -p $ssh_port; fi;}
@mveytsman
mveytsman / pedersen.py
Last active Jul 30, 2017
Pedersen commitments
View pedersen.py
# An implementation of Pedersen Commitments.
# This is like tweeting out a hash of a statement you want to make but better.
# Why is it better?
# 1) If the universe of things you want to commit to is small, an attacker can just hash them to see which one you committed to.
# 2) I'm sure there are other nice security properties but I don't know them yet.
# Learning purposes only, DON'T USE THIS, I have no idea what I'm doing, etc etc
@mveytsman
mveytsman / portscanyourself.sh
Last active Jan 18, 2017
Check that your firewall is doing what it should be. Post to slack if it's not.
View portscanyourself.sh
#!/bin/sh
# This is a script that checks to see if the open ports on a host are what you expect them to be.
# If your firewall isn't doing what it's supposed to, it will post a message to Slack to alert you.
# Intended to be run as a cron job.
#
# Requires nmap to be installed
#
# Invoke as
# ./portscanyourself example.com 80 443
# To alert you if any ports other than 80 and 443 are listening on a host
View gist:5e25443b939667860338
View gist:c03eceb1b02e1eeb3903
(defn sierpinsky [n]
(if (= 0 n)
["*"]
(let [down (sierpinsky (- n 1))
space (apply str (repeat (Math/pow 2 (- n 1)) " "))]
(concat (map #(apply str space % space) down)
(map #(clojure.string/join " " (repeat 2 %)) down)))))
(map println (sierpinsky 4))
@mveytsman
mveytsman / expression-problem.clj
Last active Nov 24, 2015
expression problem in clojure
View expression-problem.clj
(ns expression-problem)
;; Shapes have area
(defprotocol Areable
(area [this]))
;; We have circles
(defrecord Circle [radius])
;; Circles have area
@mveytsman
mveytsman / binary_search_tree.rs
Created Jun 21, 2014
binary search tree in rust
View binary_search_tree.rs
enum BinaryTree {
Node(int, Box<BinaryTree>, Box<BinaryTree>),
Leaf
}
fn insert(tree:Box<BinaryTree>, value:int) -> Box<BinaryTree> {
return box match (*tree) {
Leaf => Node(value, box Leaf, box Leaf),
Node(i, left, right) => if value < i {
Node(i, insert(left, value), right)
@mveytsman
mveytsman / phonebook.rb
Created Jun 20, 2014
Hacker School Phonebook
View phonebook.rb
#!/usr/bin/env ruby
require 'thor'
class PhoneBookCLI < Thor
no_commands do
def wrap_errors(&block)
begin
instance_eval &block
rescue Exception => e
say "#{e.message}", :red
exit
View install_wifi_access_point.sh
#!/bin/bash
### Setup a wifi Access Point on Ubuntu 12.04 (or its derivatives).
### make sure that this script is executed from root
if [ $(whoami) != 'root' ]
then
echo "
This script should be executed as root or with sudo:
sudo $0
"
View keybase.md

Keybase proof

I hereby claim:

  • I am mveytsman on github.
  • I am mveytsman (https://keybase.io/mveytsman) on keybase.
  • I have a public key whose fingerprint is 9C97 0545 A994 453D 4044 75C4 D773 5456 46C9 1E49

To claim this, I am signing this object:

You can’t perform that action at this time.