Skip to content

Instantly share code, notes, and snippets.

View uuklanger's full-sized avatar

uuklanger

View GitHub Profile
@uuklanger
uuklanger / Backup a GIT Repository.sh
Created December 24, 2016 06:00
Assuming you have a repository
#!/bin/bash
# (c)2016 KenWare
#
PROJECTS_FILE=$HOME/projects.list
REPO_DIR=/opt/data/git/repositories
BACKUP_LOCATION=/opt/backups/git_backups
CURRENT_DATE=`date +"%Y%m%d%H%M%S"`
for repo in `cat ${PROJECTS_FILE}` ; do
TARGET_ZIP=${CURRENT_DATE}"_"`echo ${repo}| sed "s/[\/\.]/_/g"`".tar.gz"
echo "REPOSITORY: "${REPO_DIR}/${repo}
@echo off
REM
REM Example of howto use a lockfile in BATCH language
REM
:INIT
CD \BatchJobs
ECHO Current Working Directory
CD
@echo off
C:
REM =======================================================================
REM Usage:
REM 1. Copy into a directory where you keep scripts
REM 2. Check the "My Locations" to ensure they align with your environment
REM 3. Confirm JAVA and Tomcat environment
REM 4. Launch and check for dysoweb-tomcat*.txt in your logs directory
REM
REM -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
@uuklanger
uuklanger / Create Missing Directories
Created December 26, 2016 19:13
As a *Build* step add the following "Execute shell" command.
cd dt_modules/sample
pwd
if [ ! -d "output_data" ]; then
mkdir output_data
fi
@uuklanger
uuklanger / XFCE4 Reverse Scroll Fix
Created January 5, 2017 22:12
Correct the scrolling in XFCE4 to be Natural Scrolling
synclient
synclient VertScrollDelta=-58
synclient HorizScrollDelta=-58
@uuklanger
uuklanger / Rename files to be all lowercase
Last active January 9, 2017 19:11
Rename files to be all lowercase
# Take a listing of files and renames to be lowercase. The ls -1 is the selector of which files are impacted so be careful.
for f in `ls -1`; do mv -v "$f" "`echo $f | tr '[A-Z]' '[a-z]'`"; done
@uuklanger
uuklanger / Create filename in DOS with Date and Time
Last active January 9, 2017 19:12
File Batch Date and Time
REM C:\Users\k.langer>echo %FNAME%
REM ARC_20150209_115340.zip
set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%
set FNAME=ARC_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%.zip
echo %FNAME%
@uuklanger
uuklanger / pyodbc_drivers.py
Created April 28, 2017 16:31
Code for determining what ODBC datasources are available
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import pypyodbc
def show_odbc_sources():
odbc_list = []
for d in pypyodbc.drivers():
odbc_list.append('%s' % (d))
@uuklanger
uuklanger / gist:6f1100a57b4e5bd683c098f496167007
Created May 26, 2017 16:47
Turn off Touchpad while typing
Name: Syndaemon
Commaond: syndaemon -i 1.0 -K -R -t
Descriptiong: Turn off trackpad while typing for Ubuntu/XBuntu
@uuklanger
uuklanger / python_tk_text_box_with_colors.py
Created June 16, 2017 17:01
Sample code that shows how to use multiple colors within a Text TK box. This is in the form of a console
from tkinter import *
root = Tk()
text = Text(root, wrap=NONE, bg="black", fg="lightgreen", font=("Consolas", 10, "normal"))
BG_EVEN = 'BG_EVEN'
BG_ODD = 'BG_ODD'
text.tag_config('FG_FATAL', foreground='yellow', background='red')
text.tag_config('FG_ERROR', foreground='orange')