Skip to content

Instantly share code, notes, and snippets.

View gyuwon's full-sized avatar

Gyuwon Yi gyuwon

View GitHub Profile
@gyuwon
gyuwon / sp-text.sql
Last active December 28, 2015 18:39
Search stored procedures which have the specified text in MS SQL Server
SELECT DISTINCT 'sp_helptext ' + b.name
FROM syscomments a WITH (NOLOCK)
JOIN sysobjects b WITH (NOLOCK) ON a.id=b.id
WHERE
a.text LIKE '%[some text]%' AND
b.xtype='p'
@gyuwon
gyuwon / ubuntu-commands
Last active December 29, 2015 12:39
Ubuntu Commands
# Remove a directory recursively
$ rm -rf [dir-name]
# Rename a directory
# mv [old-path] [new-path]
# Find a process using a specific port
$ lsof -t -i:[port-number]
$ netstat -tulpn | grep :[port-number]
<Storyboard x:Key="FlickerAnimation">
<DoubleAnimation Storyboard.TargetProperty="Opacity" AutoReverse="True" RepeatBehavior="Forever" Duration="0:0:0.5" From="0.0" To="1.0"/>
</Storyboard>
<!-- ... -->
<Style.Triggers>
<DataTrigger Binding="{Binding SomeProperty}" Value="SomeValue">
<DataTrigger.EnterActions>
<BeginStoryboard Name="Flicker" Storyboard="{StaticResource FlickerAnimation}" />
@gyuwon
gyuwon / JobPerformance.cs
Created November 29, 2013 05:14
Simple .NET performance measurement helper class
/**
* using (Job.StartNew("JobName"))
* {
* // Execution
* }
*/
class Job : System.IDisposable
{
public static Job StartNew(string name)
# Show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles -boolean true
# The reverse
defaults delete com.apple.finder AppleShowAllFiles
result='forever list | grep app.js'
if ["$result"]
then
echo "Already running."
else
forever start app.js
echo "Started."
fi
forever stop app.js
var cluster = require('cluster')
, express = require('express')
, config = require('./config/config');
if (cluster.isMaster) {
for (var i = 0; i < config.ports.length; i++) {
cluster.fork({ PORT: config.ports[i] });
}
} else {
var app = express();
public static string PropertyName<T>(Expression<Func<T>> expression)
{
if (expression == null)
throw new ArgumentNullException("expression");
var body = expression.Body as MemberExpression;
if (body == null)
throw new ArgumentException("Invalid expression", "expression");
@gyuwon
gyuwon / DynamicLinqOperations.cs
Created January 20, 2014 03:55
Dynamic Linq operations - Where, OrderBy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace DynamicLinq
{
public static class DynamicLinqOperations
{
private static MethodInfo orderByTemplate = typeof(Enumerable)