Skip to content

Instantly share code, notes, and snippets.

View janoulle's full-sized avatar

Jane Ullah janoulle

View GitHub Profile
@stut
stut / incoming_mail.php
Created November 12, 2011 11:20
Twitter email notification processor from TwitApps v1
#!/usr/bin/env php
<?php
// The email address notifications should be sent to
$____email_address = 'contact@twitapps.com';
// This array maps incoming emails to scripts
$____processor_map = array(
// For the ta_follows user there's a separate script for each notification type
'ta_follows' => array(
'is_following' => dirname(__FILE__).'/ta_follows/new_follower.php',
@janoulle
janoulle / ReversingString.java
Created December 18, 2011 15:51
Reversing a String
/**
* Author: Jane Ullah
* Purpose: Reversing a string provided by the user.
* Date: 12/18/2011
*/
import java.util.Scanner;
public class ReversingString {
public static void main(String[] args) {
@mikeal
mikeal / gist:7724521
Last active December 29, 2015 20:29
Inclusive by Exclusion

When you build a community you're creating a culture. That culture will be about more than the code, the modules, or the language. The people you draw in will have their own biases and behaviors that impact the kinds of people you continue to draw as you grow.

Cultures will naturally fight behavior that is divisive. That is, behavior that is divisive to the established members of that community. As a community grows larger it is harder and harder to change what the culture finds acceptable because changing it, even if it is inclusive in nature, is disturbing and divisive to existing membership. Fighting for change in established cultures means dealing with a lot of dismissive language and attacks for the "tone" of your argument.

That is why it is so important that a culture becomes comfortable with aggressively fighting exclusionary behavior. While it is certainly more beneficial to make pro-active steps to increase diversity we cannot be dismissive of the effect that passionate reactions to poor behavior

public void listenableFutureWithCallbackExample() {
ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUMBER_OF_THREADS));
Callable<String> asyncTask = new Callable<String>() {
@Override
public String call() throws Exception {
return computeResult();
}
};
@devilelephant
devilelephant / AWS4Signer.groovy
Last active October 21, 2019 08:24
Java/Groovy example of using Amazon AWS AWS4Signer class to sign requests (in our case elasticsearch calls)
package com.clario.aws
import com.amazonaws.DefaultRequest
import com.amazonaws.SignableRequest
import com.amazonaws.auth.AWS4Signer
import com.amazonaws.auth.AWSCredentialsProvider
import com.amazonaws.http.HttpMethodName
import groovy.util.logging.Slf4j
import org.apache.http.client.utils.URLEncodedUtils
import org.springframework.http.HttpHeaders
@jschroed91
jschroed91 / installopenssh76.sh
Last active October 3, 2020 08:50
Install openSSH 7.6 on Ubuntu 14.04
#!/bin/bash
echo "Installing deps..."
sudo apt-get install libssl-dev zlib1g-dev libpam0g-dev xz-utils
sudo apt-get remove openssh-server
echo "Downloading and extracting sources..."
wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.6p1.tar.gz
wget http://www.linuxfromscratch.org/patches/downloads/openssh/openssh-7.6p1-openssl-1.1.0-1.patch
tar -xf openssh-7.6p1.tar.gz
@grantslatton
grantslatton / fizzbuzz.c
Last active August 19, 2022 11:20
FizzBuzz solved using only bit twiddling. It essentially uses two deterministic finite automata for divisibility testing.
#include <stdio.h>
int f0(unsigned int x) { return x? (x&(1<<31)? f1(x<<1) : f0(x<<1)) : 1; }
int f1(unsigned int x) { return x? (x&(1<<31)? f3(x<<1) : f2(x<<1)) : 0; }
int f2(unsigned int x) { return x? (x&(1<<31)? f0(x<<1) : f4(x<<1)) : 0; }
int f3(unsigned int x) { return x? (x&(1<<31)? f2(x<<1) : f1(x<<1)) : 0; }
int f4(unsigned int x) { return x? (x&(1<<31)? f4(x<<1) : f3(x<<1)) : 0; }
int t0(unsigned int x) { return x? (x&(1<<31)? t1(x<<1) : t0(x<<1)) : 1; }
int t1(unsigned int x) { return x? (x&(1<<31)? t0(x<<1) : t2(x<<1)) : 0; }
int t2(unsigned int x) { return x? (x&(1<<31)? t2(x<<1) : t1(x<<1)) : 0; }
@jonmarkgo
jonmarkgo / call.php
Created March 28, 2012 17:11
Simple Phone Verification with Twilio, PHP, MySQL, and jQuery
<?php
require("Services/Twilio.php");
require("database.php");
// require POST request
if ($_SERVER['REQUEST_METHOD'] != "POST") die;
// generate "random" 6-digit verification code
$code = rand(100000, 999999);
@eriwen
eriwen / gist:188105
Created September 16, 2009 15:33
apache httpd performance settings
# Set expires header and Remove ETags
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$">
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
Header unset ETag
FileETag None
</FilesMatch>
# Set cache-control header
<FilesMatch "\.(ico|jpg|png|gif)(\.gz)?$">
Header set Cache-Control "public"
@brunodles
brunodles / gist:badaa6de2ad3a84138d517795f15efc7
Last active February 17, 2023 03:10
This is a test to show how to use expresso to check if a toast was displayed.
package com.github.brunodles.toastespresso;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;