Skip to content

Instantly share code, notes, and snippets.

@heluvaguy
heluvaguy / OracleDCN.java
Last active February 1, 2018 08:07
DCN Oracle
package com.gbm.tools;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.*;
import java.util.Properties;
@heluvaguy
heluvaguy / sort without DB :p
Created February 27, 2017 14:00
Sort csv based on a field
sort -t, -nr -k5 file.csv
# sorts in reverse based on the fifth column.
@heluvaguy
heluvaguy / query history.sql
Last active August 9, 2016 09:49
query history from TSQL
SELECT t.[text]
FROM sys.dm_exec_cached_plans AS p
CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t
WHERE t.[text] LIKE N'%something unique about your query%';
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
@heluvaguy
heluvaguy / Angular:Clock Directive.js
Created November 9, 2013 10:43
Create Clock Using AngularJs
var myApp = angular.module('myApp', []);
myApp.directive('clock', function($timeout, dateFilter){
return function(scope, element, attrs){
var timeoutId; // timeoutId, so that we can cancel the time updates
// schedule update in one second
function updateLater() {
// save the timeoutId for canceling
timeoutId = $timeout(function() {
@heluvaguy
heluvaguy / LINUX:Remove (delete) an extension from all files
Created October 26, 2013 09:57
Remove (delete) an extension from all files
for f in *.txt; do mv $f `basename $f .txt`; done;
@heluvaguy
heluvaguy / LINUX: Add (append) an extension to all files
Created October 26, 2013 09:56
Add (append) an extension to all files
for f in *; do mv $f `basename $f `.txt; done;
@heluvaguy
heluvaguy / LINUX: Change from one extension to another
Created October 26, 2013 09:56
Change from one extension to another
for f in *.php4; do mv $f `basename $f .php4`.php; done;Add (append) an extension to all files
@heluvaguy
heluvaguy / PSQL: KILL QUERY
Created October 17, 2013 05:34
kill a postgresql query
SELECT pg_cancel_backend(pid of the process)
@heluvaguy
heluvaguy / Psql: SHOW CURRENT QUERIES
Created October 17, 2013 05:26
SHOW CURRENT QUERIES
SELECT datname,procpid,current_query FROM pg_stat_activity