Skip to content

Instantly share code, notes, and snippets.

View sankars's full-sized avatar

Sankar sankars

  • Dubai
View GitHub Profile
# From http://stackoverflow.com/questions/7027288/error-could-not-find-function-in-r
help.search("some.function")
??some.function
RSiteSearch("some.function")
@sankars
sankars / subset.r
Created April 17, 2014 17:21
Subset operations in R
# http://stackoverflow.com/questions/9860090/in-r-why-is-better-than-subset
subset(airquality, Month == 8 & Temp > 90)
airquality[airquality$Month == 8 & airquality$Temp > 90, ]
@sankars
sankars / hadoop.sh
Created April 18, 2014 17:07
Hadoop Shell Commands
# http://stackoverflow.com/questions/17079513/hdfs-replication-factor-change
hadoop fs -setrep -R 2 /
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open Command Window Here as Administrator"
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
@sankars
sankars / mysql_meta.sql
Created April 23, 2014 07:01
Mysql meta data related queries
-- http://stackoverflow.com/questions/898688/how-to-get-database-structure-in-mysql-via-query
DESCRIBE table;
SHOW TABLES;
SHOW TABLES LIKE '%filter%'
-- print create table query
@sankars
sankars / commands.groovy
Created April 23, 2014 12:48
Basic groovy commands
import org.joda.time.*
a = new DateTime()
println(a.getMillis())
println(new Date())
## create a local repo and commit it to github account
## http://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-ssh
mkdir projectname
cd projectname
git init
touch file1
@sankars
sankars / sysinfo.sh
Created April 25, 2014 07:56
Commands to show system details & configurations
## From http://askubuntu.com/questions/18372/how-can-i-find-out-what-ram-a-computer-system-has
## find hardware info
sudo dmidecode -t memory ## RAM info
## http://askubuntu.com/questions/146621/what-is-the-equivalent-of-windows-system-properties-or-device-manager
lshw
@sankars
sankars / administration_commands.sql
Created April 29, 2014 02:43
SQL Server administrative tasks
-- From http://dba.stackexchange.com/questions/6031/how-do-you-kick-users-out-of-a-sql-server-2008-database
-- hit Ctrl+Shift+M in SSMS to fill in the template parameter
USE master;
GO
ALTER DATABASE N'<Database Name, sysname,>'
SET SINGLE_USER
@sankars
sankars / mysql_ddl.sql
Created April 29, 2014 06:12
Mysql queries dealing with structures of tables and views
-- From http://stackoverflow.com/questions/5452760/truncate-foreign-key-constrained-table
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE table1;
TRUNCATE table2;
SET FOREIGN_KEY_CHECKS=1;