Skip to content

Instantly share code, notes, and snippets.

radityo radityopw

View GitHub Profile
View python_change_tracking_process.py
import sqlalchemy
from sqlalchemy.pool import NullPool
from sqlalchemy import text
def connect_sqlserver():
user = ""
password = ""
database = ""
View mariadb_pegawai_replicated.sql
CREATE TABLE `pegawai_replicated` (
`id` int(11) NOT NULL,
`nama` varchar(50) NOT NULL,
`jenis_kelamin` char(1) NOT NULL,
`is_deleted` tinyint(4) NOT NULL
) ENGINE=Aria DEFAULT CHARSET=utf8mb4;
ALTER TABLE `pegawai_replicated`
ADD PRIMARY KEY (`id`);
View sqlserver_change_tracking_trigger.sql
CREATE TABLE [dbo].[pegawai](
[id] [int] IDENTITY(1,1) NOT NULL,
[nama] [varchar](20) NOT NULL,
[jenis_kelamin] [char](1) NOT NULL,
[create_at] [datetime] NOT NULL,
[update_at] [datetime] NOT NULL,
CONSTRAINT [PK_pegawai] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
@radityopw
radityopw / table_to_temporal_table_sqlserver.sql
Last active Jul 20, 2020
convert ordinary sqlserver table, to temporal table
View table_to_temporal_table_sqlserver.sql
declare @table nvarchar(255)
declare @sql nvarchar(max)
-- setting table name
set @table = 'dbo.test'
-- adding starttime , endtime columns
set @sql = '
View html_1st_table_to_csv.py
from bs4 import BeautifulSoup
import requests
import pandas as pd
url = 'YOUR URL HERE'
response = requests.get(url)
soup = BeautifulSoup(response.text,'lxml')
tables = soup.find_all('table')
@radityopw
radityopw / gen_trans_log_restore.php
Last active Apr 3, 2018
script untuk generate transaction log sqlserver dari list file yang ada di folder
View gen_trans_log_restore.php
<?php
/*
asumsi adalah nama trans log adalah *.trn
asumsi lain adalah nama log file melambangkan waktu dicreate nya , nama sudah terurut
*/
$dir = $argv[1]."\\*.trn";
$dbname = $argv[2];
View curl.php
<?php
$cURL = curl_init();
$User_Agent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31';
$cookies = 'CookieName1=Value;CookieName2=Value';
curl_setopt($cURL, CURLOPT_USERAGENT, $User_Agent);
curl_setopt($cURL, CURLOPT_COOKIE, $cookies);
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HTTPGET, true);
View dummy_code_kupon.php
<?php
// membuat koneksi
$con = mysqli_connect('localhost','root','');
mysqli_select_db($con,"coupon_test");
// set kode kupon
$code = "CQ839";
@radityopw
radityopw / kupon.sql
Created Feb 15, 2017
contoh pembuatan tabel kupon.sql
View kupon.sql
CREATE TABLE `kupon` (
`code` varchar(5) NOT NULL,
`max_usage` int(11) NOT NULL DEFAULT '10',
`usage` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `kupon` (`code`, `max_usage`, `usage`) VALUES ('CQ839', '10', '0');
You can’t perform that action at this time.