Skip to content

Instantly share code, notes, and snippets.

View Tantas's full-sized avatar

Joseph Preiss Tantas

  • Toronto Area, Ontario, Canada
View GitHub Profile
@Tantas
Tantas / vpnsetup.sh
Last active March 25, 2023 16:13 — forked from hwdsl2/.MOVED.md
Ubuntu 14.04 LTS L2TP/IPSec VPN Behind NAT
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
@Tantas
Tantas / UITableView_Seperator_Inset_Removal.m
Created October 10, 2014 21:01
iOS7+ Remove UITableView Separator inset
// Place in implementation of UITableViewDelegate
#pragma mark - Remove Seperator Inset
// Refer to http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working#answer-25877725
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
@Tantas
Tantas / increase_max_files_osx.sh
Created October 9, 2014 18:00
Increase OSX file limit for load testing
# Issues load testing a server on OSX, need to increase the OS limitations to get some real numbers out of everything
# Check what the current values are
sysctl kern.maxfiles
sysctl kern.maxfilesperproc
ulimit -S -n
# Increase the files per process
sudo sysctl -w kern.maxfiles=1048600
sudo sysctl -w kern.maxfilesperproc=1048576
ulimit -S -n 1048576
#import <SpriteKit/SpriteKit.h>
CGFloat DIM_DEFAULT_ZINDEX = 10.0f;
@interface SKScene (Dimmable)
/** Dims everything on the screen below the z-index to the provided color.
Percentage should be between 0.0f and 1.0f.
*/
@Tantas
Tantas / ubuntu_setup_environment.sh
Created September 12, 2014 17:35
Setup a comfortable Ubuntu environment
# Login into the server
ssh user@ip-address
# Apply updates
sudo apt-get update && sudo apt-get upgrade
# Create a user to work under
sudo useradd -m -G sudo -s /bin/bash joe
passwd joe
@Tantas
Tantas / SKTexture+Gradient.h
Last active July 19, 2022 09:59
Creates a SKTexture programatically with a vertical gradient.
#import <SpriteKit/SpriteKit.h>
@interface SKTexture (Gradient)
/** Creates a SKTexture programatically with a vertical gradient.
Great suggestion for colors: http://ios7colors.com/.
Example:
(Inside a SKScene class)
@Tantas
Tantas / NPointedStar.h
Last active August 29, 2015 14:05
Creates a nPointed star with the odd point at the center-top.
#import <SpriteKit/SpriteKit.h>
@interface NPointedStar : SKShapeNode
/** Creates a nPointed star with the odd point at the center-top.
Must provide all parameters normally added to a SKShapeNode except for the path.
Example:
(Inside a SKScene class)
@Tantas
Tantas / list_git_remotes_in_folder.sh
Created August 18, 2014 19:33
List the repository remotes found in a supplied directory
#!/bin/sh
# List the repository remotes found in a supplied directory.
# List the available repositories if no argument
if [[ "$#" -ne 1 ]]; then
echo "Provide a directory containing repositories."
exit -1
fi
@Tantas
Tantas / clone_gitolite_repo.sh
Created August 18, 2014 19:31
List and clone gitolite repos using ssh keys
#!/bin/sh
# List and clone gitolite repos using ssh keys
# Note: 'privategit' is a host found in ~/.ssh/config
# List the available repositories if no argument
if [[ "$#" -ne 1 ]]; then
echo "Provide the name of the project to clone"
echo "Available projects are:"
ssh privategit info 2>/dev/null | tail -n +3 | awk '{ print $3 }'
@Tantas
Tantas / github_public_repository_list.py
Created August 17, 2014 19:47
Get public repository list from GitHub.
#!/usr/bin/env python
"""
Get public repository list from github. Must modify the user name in the script.
"""
import json
import urllib2
# Determine the github api call for the repository list