Skip to content

Instantly share code, notes, and snippets.

View JahsonKim's full-sized avatar

JahsonK JahsonKim

View GitHub Profile
.header {
padding-left: 10px;
padding-right: 10px;
text-transform: uppercase;
font-weight: 800;
font-size: 18px;
}
.step-right {
padding: 2px;
@JahsonKim
JahsonKim / clrProcedure.sql
Last active October 19, 2020 09:05
How to create a CLR procedure that invokes the clrExample.cs method.
CREATE PROCEDURE [dbo].[postData]
@postData NVARCHAR(4000),
@returnval NVARCHAR(2000) OUTPUT
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [CLRAssembly].[CLRExample].[postData]
--After creating the clrExample.cs class in visual studio generate a dll file that you add into your
--SQL server with the name CLRAssembly.
@JahsonKim
JahsonKim / clrExample.cs
Last active May 17, 2023 12:45
C# SQL Server CLR example.
using Microsoft.SqlServer.Server;
//------------------------------------------------------------------------------
// <copyright file="CSSqlClassFile.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.IO;
@JahsonKim
JahsonKim / back_up_db_mysql.php
Last active January 20, 2018 08:52
Back up MYSQL database in PHP.
<?php
/* Some times you may wonder how you can automatically back up your Mysql database.
This functions helps you create a back up file for your mysql databases
*/
define ('DATABASE_NAME','YOR DATABASE NAME');
define ('DATABASE_USER','DATABASE USERNAME');
@JahsonKim
JahsonKim / enableOleAutomation.sql
Last active May 17, 2023 12:56
How to send http POST request from sql server stored procedure. Important! For some reason sp_OAGetProperty is returning null. Am not sure why and if anyone has an idea can update the gists. In case you need to try another option SQL CLR would help. Check here https://gist.github.com/JahsonKim/05e6af7744f2d7ef814e5ed331419db5
--This query enables ole automation procedures. set 0 to disable
exec master.dbo.sp_configure 'Ole Automation Procedures', 1
RECONFIGURE
--OLE utomation disabled the following error is thrown.
--SQL Server blocked access to procedure 'sys.sp_OACreate' of component
--'Ole Automation Procedures' because this component is turned off as part
--of the security configuration for this server.
--A system administrator can enable the use of 'Ole Automation Procedures'
<?php
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
* Contributions by:
* Yousuke Kumakura (Attribute filters)
* Vadim Voituk (Negative indexes supports of "find" method)
* Antcs (Constructor with automatically load contents either text or file/url)
*
* all affected sections have comments starting with "PaperG"
<?php
include_once('simple_html_dom.php');
$html = new simple_html_dom();
if(isset($_POST['crawl'])){
$crawl = $_POST['target'];
$find = "http://";
//Change "http://" to https// if you are crawling a an https site otherwise keep it http
if(strpos($crawl,$find)!==false){
$html->load_file($crawl);
@JahsonKim
JahsonKim / index.php
Last active August 10, 2016 08:48
A web crawler is a program that visits Web sites and reads their pages and other information in order to create entries for a search engine index. This is a simple PHP web crawler sample code.
<!DOCTYPE html>
<html>
<head>
<title>Simple PHP Web Crawler</title>
<link type="text/css" rel="stylesheet" href="style.css" />
</head>
<body>
<form method="post" action="crawler.php">
<p style="text-align:center;"><input type="text" name="target" class="input" placeholder="Type site url here" /></p>
<p style="text-align:center;"><input type="submit" name="Crawl Site" class="button" value="Crawl !" /></p>
@JahsonKim
JahsonKim / Authorization.java
Last active March 2, 2016 12:50
How to Load Trending Hashtags using the Twitter Fabric and REST API. Ensure you install the Twitter Fabric SDK on your app to be able to run this. The SDK is available Here.
import android.content.Context;
import android.util.Base64;
import android.util.Log;
import com.oceanscan.twitter.utils.ConstantUtils;
import com.squareup.okhttp.FormEncodingBuilder;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;