The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
/** Implementation of the interface StackInt<E> using | |
* an array. | |
* @author Koffman & Wolfgang | |
*/ | |
package com.jasimmonsv.Simmons_HW5; | |
import java.util.EmptyStackException; | |
public class arrayStack<E> implements StackInt<E> { |
package com.jasimmonsv.Simmons_HW5; | |
public interface StackInt<E> { | |
E push(E obj); | |
E peek(); | |
E pop(); | |
boolean empty(); |
package com.jasimmonsv.Simmons_HW5; | |
import java.util.EmptyStackException; | |
import com.jasimmonsv.Simmons_HW5.*; | |
//** Section 3.3 Exercise 2 | |
public class TestArrayStack { | |
public static void main(String[] args){ |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $string = 'perlmeme.org'; | |
my $char = 'e'; | |
my $offset = 0; | |
my $result = index($string, $char, $offset); |
#!/usr/bin/env python | |
# found on web archive: http://web.archive.org/web/20131017130434/http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ | |
import sys, os, time, atexit | |
from signal import SIGTERM | |
class Daemon: | |
""" | |
A generic daemon class. | |
refname="$1" | |
oldrev="$2" | |
newrev="$3" | |
# --- Safety check | |
if [ -z "$GIT_DIR" ]; then | |
echo "Don't run this script from the command line." >&2 | |
echo " (if you want, you could supply GIT_DIR then run" >&2 | |
echo " $0 <ref> <oldrev> <newrev>)" >&2 | |
exit 1 |
import json | |
import urllib | |
import boto3 | |
lam = boto3.client('lambda') | |
def lambda_handler(event, context): | |
payload = {} | |
payload['key1'] = 'key1' | |
payload['key2'] = 'key2' |
import random | |
import string | |
def rand_string(rrange=25): | |
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(rrange)) | |
def rand_email(): | |
return '{}@{}.{}'.format(rand_string(10), rand_string(7), rand_string(3)) |
This are my cheat sheets that I have compiled over the years. Tired of searching Google for the same things, I started adding the information here. As time went on, this list has grown. I use this almost everyday and this Gist is the first bookmark on my list for quick and easy access.
I recommend that you compile your own list of cheat sheets as typing out the commands has been super helpful in allowing me to retain the information longer.