Skip to content

Instantly share code, notes, and snippets.

View sankars's full-sized avatar

Sankar sankars

  • Dubai
View GitHub Profile
@sankars
sankars / system_details.py
Created May 19, 2014 17:58
Python script for print details about python kit and system
## http://stackoverflow.com/questions/4583367/how-to-run-multiple-python-version-on-windows
## print installed version of python
python -V
import sys
sys.version
-- From http://stackoverflow.com/questions/121243/hidden-features-of-sql-server
DELETE FROM (table)
OUTPUT deleted.ID, deleted.Description
WHERE (condition)
INSERT INTO MyTable(Field1, Field2)
OUTPUT inserted.ID
VALUES (Value1, Value2)
-- From http://stackoverflow.com/questions/175415/how-do-i-get-list-of-all-tables-in-a-database-using-tsql
-- list all tables
SELECT * FROM information_schema.tables
SELECT * FROM sysobjects WHERE xtype='U'
SELECT * FROM sys.tables;
@sankars
sankars / sqlserver_ddl_commands.sql
Created April 29, 2014 06:27
Sql server DDL commands
-- From http://stackoverflow.com/questions/155246/how-do-you-truncate-all-tables-in-a-database-using-tsql
-- disable all constraints
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- delete data in all tables
EXEC sp_MSForEachTable "DELETE FROM ?"
-- enable all constraints
@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;
@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 / 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
## 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 / commands.groovy
Created April 23, 2014 12:48
Basic groovy commands
import org.joda.time.*
a = new DateTime()
println(a.getMillis())
println(new Date())
@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