Skip to content

Instantly share code, notes, and snippets.

View sbose78's full-sized avatar
🎯
Focusing

Shoubhik Bose sbose78

🎯
Focusing
View GitHub Profile
@sbose78
sbose78 / views.py
Created September 9, 2012 20:02
Uploading files in Django using pymongo
import os
import gridfs
from django.http import HttpResponse
from pymongo.connection import Connection
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.template import Context, RequestContext,loader
from bson.object import ObjectId
#uploading form including image/file
@sbose78
sbose78 / DbCon.java
Created May 22, 2013 05:46
The config files used for Db Connection pooling
public static Connection getPooledDbConnection() throws NamingException, SQLException
{
Context initContext = new InitialContext();
DataSource ds = (DataSource)initContext.lookup("java:/comp/env/jdbc/TestDB");
Connection conn = ds.getConnection();
return conn;
}
@sbose78
sbose78 / context.xml
Created May 22, 2013 06:06
Files to be added.
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/udhc-eclipse-tomcat6" docBase="udhc-eclipse-tomcat6" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="20" maxIdle="5"
username="root" password="qwerty"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/udhc_local_db" />
<Resource name="jdbc/awsDB" auth="Container" type="javax.sql.DataSource"
testWhileIdle="true"
/*!
* Bootstrap v2.3.2
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
@sbose78
sbose78 / runby_install
Created April 10, 2015 10:39
install ruby 2.2.0
apt-get update
apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz
tar -xvzf ruby-2.0.0-p481.tar.gz
cd ruby-2.0.0-p481/
./configure --prefix=/usr/local
make
sudo make install
This file has been truncated, but you can view the full file.
PG::UndefinedTable: ERROR: relation "settings" does not exist
LINE 5: WHERE a.attrelid = '"settings"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"settings"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
@sbose78
sbose78 / test.sh
Last active August 29, 2015 14:26
#!/bin/bash
#while [ true ]
#do
d=`date +%s`
v=`shuf -i 1-100 -n 1`
echo "jmx.test.cpu $d $v appname=app2"
sleep 1s
// This #include statement was automatically added by the Particle IDE.
#include "SparkJson/SparkJson.h"
#include "application.h"
#include "HttpClient/HttpClient.h"
#include "string.h"
unsigned int nextTime = 0; // Next time to contact the server
void setup() {
Serial.begin(9600);
@sbose78
sbose78 / gist:df343fce3104c237aa5b
Created February 13, 2016 07:41
Jboss jboss-as-7.1.1.Final/standalone/configuration/standalone.xml for running EJBCA.
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:1.2">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.configadmin"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>