Skip to content

Instantly share code, notes, and snippets.

View tckb's full-sized avatar
:octocat:

Chandra (tckb) tckb

:octocat:
View GitHub Profile
@tckb
tckb / GeoLocator-sim.py
Last active February 5, 2016 20:30
A python client to simulate device pushes into GeoLocator service
#!//usr/local/bin/python
# Author: tckb <[email protected]>
# A python client to simulate device pushes into GeoLocator service
# Usage:
# ./GeoLocator-sim.py --show (-s) [devices/clusters]: shows devices or clusters available in server
# ./GeoLocator-sim.py --reset (-r) : resets the simulation devices
# ./GeoLocator-sim.py --addDevice : registers new device
# ./GeoLocator-sim.py --start (-S) : starts simulation
# ./GeoLocator-sim.py --help (-h) : prints this message
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.chemspider.www.examples;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@tckb
tckb / SMSClient.java
Last active August 29, 2015 14:08
Code snippet to pop up the default sms client on Android
private void sendSMS(){
Intent smsIntent;
// Check the version of the android
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
{
// Get default sms package, if exists
String smsPackage = Telephony.Sms.getDefaultSmsPackage(this);
smsIntent = new Intent(Intent.ACTION_SEND);
smsIntent.setType("text/plain");
public class CalculateDescriptors
{
private static void forTrainingSet(String smileFile)
throws FileNotFoundException
{
IteratingSMILESReader reader = new IteratingSMILESReader(new FileInputStream(smileFile), DefaultChemObjectBuilder.getInstance());
while (reader.hasNext())
{
IAtomContainer molecule = reader.next();
ToxDescriptor desc = new ToxDescriptor();
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jnatest;
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import com.sun.corba.se.impl.orb.ParserTable.TestORBSocketFactory;
@tckb
tckb / notify_ping.sh
Last active February 14, 2019 11:46
Small bash script for notifying the internet connection. Raises a notification when connection is lost.
#!/bin/bash
# Author: tckb<[email protected]>
# Ping notification using terminal- notifier; for OsX
# Usuage: ./notify_ping.sh <check_freq_seconds> &
rm $HOME/.np_click 2>/dev/null
if [ -z ${1} ]
then
freq=5 #check every 5 seconds
else
freq=$1
#!/bin/bash
#Author: tckb <[email protected]>
# Parallizing OSRA evaluation using GNU Parallel
# Usuage ./eval_dataset_faster.sh [ dataset directory with "images" dir and "sdf" dir]
eval_dir=$1
checkingJar='/Users/tckb/Projects/Vishal/OSRAChem/dist/OSRAChem.jar'
pass=0
fail=0
#!/bin/bash
#Author: tckb < [email protected]>
# Evaluation script for OSRA
# Usuage ./eval_dataset_slow.sh [ dataset directory with "images" dir and "sdf" dir] [ enhancement; 1 - use enhancement; 0-no]
eval_dir=$1
enhance=$2 # 1 - use imagemaik
checkingJar='/Users/tckb/Projects/Vishal/OSRAChem/dist/OSRAChem.jar'
pass=0
public static int getRadius(int[][] distMatrix){
int radius = Integer.MAX_VALUE;
//biggest value in evry column of the matrix = ece
// radius = minium eccentricity of a molecule
for(int r=0;r<distMatrix.length;r++){
int maxDist=0;
for(int c=0;r<distMatrix.length;r++){
if(distMatrix[r][c] > maxDist ){
maxDist = distMatrix[r][c];
@tckb
tckb / SaveObject.java
Last active December 31, 2015 20:38
Code fragment
// Code part of tckb-lib
// Author: tckb <[email protected]>
// https://github.com/tckb/jAudIO.pub
public static void saveObjectToFile(File thatFile, Object... thisObject) {
mylogger.log(Level.INFO, "Saving object{0} to file: {1}", new Object[]{thisObject.hashCode(), thatFile.getAbsolutePath()});
ObjectOutputStream stream;
try {
stream = new ObjectOutputStream(new FileOutputStream(thatFile));