Skip to content

Instantly share code, notes, and snippets.

@folex
folex / awslist
Last active July 7, 2021 12:05
Opens ssh connections to aws or digitalocean host which starts with $1. Save as `awslist` or `dolist` for AWS and DO respectively.
#!/bin/bash
name=""
REGION="eu-central-1"
LISTONLY=false
SHOULDFORWARD=false
OSNAME=`uname`
TITLE="Name PublicIP PrivateIP InstanceType InstanceId PlacementGroup Purpose"
@folex
folex / stress.yml
Created September 14, 2015 10:31
Cassandra stress config
### DML ###
keyspace: stress
keyspace_definition: |
CREATE KEYSPACE stress WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
table: messages
table_definition: |
CREATE TABLE stress.messages (
@folex
folex / shapeless_explained.md
Last active August 29, 2015 14:27
Shapeless SelectLeast step by step

We: Hey, find me TM and TRem such that exists SelectLeast[T, TM, TRem] where T defined by L = H :: T. And TM < H should hold.

1. hlistSelectLeast3 works since precedence

hlistSelectLeast3[H = _1, T = _2 :: _3 :: HNil, TM = ?, TRem = ?]: SelectLeast[H :: T, TM, H :: TRem]

We: Hey, find me TM2 and TRem2 such that exists SelectLeast[T2, TM2, TRem2] where T2 defined by T == H2 :: T2. And TM2 < H2 should hold.

2. hlistSelectLeast3 works since precedence

signature Set =
sig
type Elem
type Set
val empty : Set
val insert : Elem * Set -> Set
val member: Elem * Set -> bool
end
signature Ordered =
for i in `cat /tmp/proxies`
do
PROXY=$(curl -s -x $i -l http://whatismycountry.com/ | grep ^Proxy)
echo $i $PROXY
done
@folex
folex / UIView+AddSubviews
Created April 8, 2014 11:37
UIView category to add multiple subviews at once
//.h
@interface UIView (AddSubviews)
- (void) addSubviews:(UIView*) subview1, ...
NS_REQUIRES_NIL_TERMINATION;
@end
//.m
@implementation UIView (AddSubviews)
- (void)addSubviews:(UIView *)subview1, ... {