Skip to content

Instantly share code, notes, and snippets.

@MagerValp
MagerValp / 99-filtersecuredebug.sh
Created April 30, 2012 09:25
This removes lines containing passwordAsUTF8String in /var/log/secure.log*
#!/bin/bash
#
# This removes lines containing passwordAsUTF8String in /var/log/secure.log*
templog=`mktemp -t securelog`
for logfile in /var/log/secure.log*; do
echo "Filtering passwords from $logfile"
if [ ${logfile##*.} == "bz2" ]; then
@dentarg
dentarg / pdf-reader.rb
Created July 11, 2012 13:39
Convert a PDF to text, HTML and XML with various tools
#!/usr/bin/env ruby
require 'pdf-reader'
infile=ARGV[0]
outfile=ARGV[1]
reader = PDF::Reader.new(infile)
text = ""
reader.pages.each do |page|
@dmytro
dmytro / ssh-multi.sh
Created October 31, 2012 03:46
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi
# D.Kovalov
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
starttmux() {
if [ -z "$HOSTS" ]; then
#!/bin/bash
DEBIAN_HOSTS="server1 server2 server3";
LOG_FILE="server-update-`date +%Y%m%d%H%M%S`.log"
requires_reboot="";
function execute_command()
{
command="$1";
@CocoaBeans
CocoaBeans / config.fish
Last active October 27, 2022 21:08
Fish shell custom prompt
########################################################################################
### Fish Custom Overrides
### Creates a shell prompt in the form of:
###
### ----------------------------------------------------------------------- 11:56:05
### kevin@kross /S/L/F/C/V/A/F/L/V/A/Support >
########################################################################################
set --global fish_prompt_username_color 555555
@scifiman
scifiman / gist:5109047
Created March 7, 2013 15:56
LaunchDaemon to check Adobe Flash version versus Apple's XProtect.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.xprotect_re-enable_adobe_flash</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>/Library/Scripts/xprotect_re-enable_adobe_flash.sh</string>
@dentarg
dentarg / ruby_date_time.md
Last active July 16, 2025 02:07
Ruby time and date classes

MySQL

http://dev.mysql.com/doc/refman/5.5/en/datetime.html

MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval.

By default, the current time zone for each connection is the server's time. The time zone can be set on a per-connection basis. As long as the time zone setting remains constant, you get back the same value you store. If you store a TIMESTAMP value, and then change the time zone and retrieve the value, the retrieved value is different from the value you stored. This occurs because the same time zone was not used for conversion in both directions. The current time zone is available as the value of the time_zone system variable. For more information, see Section 10.6, “MySQL Server Time Zone Support”.

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_time_zone

@bryanzak
bryanzak / AccountRenamer.command
Created August 22, 2014 04:12
This is a script we have used for a while to rename an Active Directory user account that is cached locally. When a teacher has a name change, their AD short name changes, but not the user ID. OS X doesn't like this. So this script is run by our field techs from an admin account to simply rename the account from old to new. The teacher can then …
#!/bin/bash
# AccountRenamer.command
#
# Interactive tool to rename an account from one name to another (like when a teacher gets renamed and their e account changes)
#
# HISTORY:
#
# 1.0 2013-03-25 bmp - initial release