Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Schoen richardschoen

View GitHub Profile
@richardschoen
richardschoen / gist:78ed5bd3b0656ba8eb4adfff9715e811
Created Nov 1, 2018
C# - set directory permissions for Everyone to Full Control. Useful when you need to store settings and other files in your app directory
View gist:78ed5bd3b0656ba8eb4adfff9715e811
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Principal;
using System.Security.AccessControl;
using System.IO;
namespace RSSetDirPermissionsCS
@richardschoen
richardschoen / gitcommitchgs.sh
Created May 27, 2020
Single sample bash command to stage, commit, push and pull changes to remote git repository with timestamped comment
View gitcommitchgs.sh
#!/bin/bash
# This script can be used to commit changes to git repo and push to
# remote repo all in one command.
TODAY=$(date)
HOST=$(hostname)
git add .
git commit -m "Changes committed: $TODAY from $HOST"
git push
git pull
@richardschoen
richardschoen / sqlitedbtest1.py
Created Mar 6, 2020
Python 3 Script to Test SQLite DB
View sqlitedbtest1.py
#!/usr/bin/python
#------------------------------------------------
# Script name: sqlitedbtest1.py
#
# Description:
# This script is a good test program for SQLite DB
# functionality.
#
# Parameters:
# P1=
@richardschoen
richardschoen / ODBCCoreTest1.cs
Created Feb 26, 2020
Test IBMi Access ODBC Driver on Linux, Windows or IBM i
View ODBCCoreTest1.cs
using System;
using System.Text;
using System.Data;
using System.Data.Odbc;
using System.Collections.Generic;
namespace OdbcCoreTest1
{
// https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzaik/connectkeywords.htm
// https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_71/rzaik/rzaikodbc64bitrestrictions.htm
@richardschoen
richardschoen / gist:3abab4dce5b9e1254313219f38feb45a
Created Feb 26, 2020
Turn on trace with IBMi Access ODBC Driver
View gist:3abab4dce5b9e1254313219f38feb45a
/opt/ibm/iaccess/bin/cwbtrc /dt:1 # enable trace
# run code to recreate here
/opt/ibm/iaccess/bin/cwbtrc /dt:0 # disable trace
/opt/ibm/iaccess/bin/cwbmedic # generate diagnostic tar file
@richardschoen
richardschoen / IBMiXmlserviceRemoteCommand
Created Aug 27, 2017
IBM i XMLSERVICE remote command call sample
View IBMiXmlserviceRemoteCommand
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IbmiXmlserviceStd;
namespace IbmiXmlServiceCommandSample1Cs
{
class Program
@richardschoen
richardschoen / DataTableToJsonObj.cs
Created Aug 27, 2017
DataTable Object to JSON Object using String Builder
View DataTableToJsonObj.cs
public string DataTableToJsonObj(DataTable dt)
{
DataSet ds = new DataSet();
ds.Merge(dt);
StringBuilder JsonString = new StringBuilder();
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
JsonString.Append("[");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
@richardschoen
richardschoen / 0_reuse_code.js
Created Dec 25, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console