Skip to content

Instantly share code, notes, and snippets.

Sub myline(x1, x2, l)
Dim i As Integer
Dim shp As Shape
Dim sld As Slide
Set sld = Application.ActiveWindow.View.Slide
Set shp = sld.Shapes.AddShape(37, x1, 10 * l, x2 - x1, 0)
shp.Fill.ForeColor.RGB = RGB(137, 143, 75)
shp.Fill.BackColor.RGB = RGB(137, 143, 75)
shp.ShapeStyle = 10002
@tsohr
tsohr / monitor
Last active August 29, 2015 14:05
#!/bin/sh
( tail -n 0 -f --follow=name --retry $* \
/var/log/audit/audit.log \
/var/log/messages \
/var/log/httpd/*log \
/var/log/tomcat/catalina.out \
/var/log/tomcat-rewrite.log \
/var/log/nginx/*log \
/var/log/firewalld \
/var/log/secure \
#!/bin/bash
/bin/socat TCP-LISTEN:23455,fork SYSTEM:"/root/monitor"
CREATE TABLE usertickets (
email varchar(128) NOT NULL default '',
ticket varchar(32) NOT NULL default '',
repositorygrants integer NOT NULL default '0'
);
CREATE TABLE usersgroups (
userid integer default '0',
groupid integer default '0'
);
CREATE TABLE users (
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
pushd "$DIR" > /dev/null
tar -z -p -c -f `date +"%Y%m%d-%H%M%S"`.www.gz -C / -P /etc/httpd/ /srv/www/
BACKUP_CNT=`ls *.www.gz | wc -l`
if [ "$BACKUP_CNT" -gt "15" ]; then
LAST_BACKUP=`ls *.www.gz | sort | head -n 1`
rm -f $LAST_BACKUP
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
pushd "$DIR" > /dev/null
su -l -c "pg_dumpall" postgres | gzip > `date +"%Y%m%d-%H%M%S"`.sql.gz
BACKUP_CNT=`ls *.sql.gz | wc -l`
if [ "$BACKUP_CNT" -gt "15" ]; then
LAST_BACKUP=`ls *.sql.gz | sort | head -n 1`
#!/bin/bash
if [ -z "$1" ]; then
echo "$0: need an input set file";
exit 1;
fi
if [ ! -f "$1" ]; then
echo "$0: file not found '$1'";
exit 1;
fi
@tsohr
tsohr / ImageInsert.bas
Last active August 29, 2015 14:07
Insert pictures from a DIR expression on a MS Word docs. Resize/crop pictures from a selection basis.
Option Explicit
Public pictureSizeWidth As Integer
Public pictureSizeHeight As Integer
Public Sub insertPicture(file As String, width As Integer)
Dim shp As InlineShape
Set shp = ActiveDocument.InlineShapes.AddPicture( _
FileName:=file, _
LinkToFile:=False, _
SaveWithDocument:=True)
@tsohr
tsohr / !tomcat-rewrite.cpp
Last active August 29, 2015 14:15
tomcat_rewrite
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <vector>
#include <iterator>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cctype>
@tsohr
tsohr / !Melzi upload
Created February 18, 2015 08:25
Sanguino for arduino 1.6.0
cd "C:\Program Files (x86)\Arduino"
"hardware\tools\avr\bin\avrdude"
-C"C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
-v -patmega1284p -Pcom5 -b19200
-c avrisp -Uflash:w:C:\USERS\ADMINI~1\APPDATA\LOCAL\TEMP\build8351945056164552931.tmp/Marlin.cpp.hex:i