Skip to content

Instantly share code, notes, and snippets.

View syamsathyan's full-sized avatar

Syam Sathyan George syamsathyan

View GitHub Profile
@syamsathyan
syamsathyan / hipchat-v2.sh
Created August 3, 2016 00:29 — forked from danriti/hipchat-v2.sh
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
make install
@syamsathyan
syamsathyan / gist:c4fa0fb14dfbdd8f50bcc87659495c7e
Created June 21, 2016 03:56 — forked from brandonmwest/gist:4512396
curl + PHP example of using the SendGrid web api

This example uses cURL with PHP through our web API to send an email.

<?php $url = 'http://sendgrid.com/';
$user = 'USERNAME';
$pass = 'PASSWORD'; 
 
$params = array(
    'api_user'  => $user,
 'api_key' =&gt; $pass,
public class RedisClient {
private JedisPool pool;
@Inject
public RedisClient(Settings settings) {
try {
pool = new JedisPool(new JedisPoolConfig(), settings.get("redis.host"), settings.getAsInt("redis.port", 6379));
} catch (SettingsException e) {
// ignore
from fabric.api import cd, env, run
def BF():
env.hosts = ['']
def GBL():
env.hosts = ['']
def free():
run('free -h')
public static class BaseKeyGenerator
{
public static void TestBaseKeyGenerator()
{
// create five IDs of six, base 62 characters
for (int i=0; i<5; i++) Console.WriteLine(BaseKeyGenerator.GetBase62(6));
// create five IDs of eight base 36 characters
for (int i=0; i<5; i++) Console.WriteLine(BaseKeyGenerator.GetBase36(8));
redisServer.start();
//Start Jedis ConnFactory
JedisShardInfo shardInfo = new JedisShardInfo("localhost", 6379);
connectionFactory = new JedisConnectionFactory();
connectionFactory.setShardInfo(shardInfo);
//Init RedisTemplate
template = new StringRedisTemplate();
template.setConnectionFactory(connectionFactory);
template.afterPropertiesSet();