Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / days.sh
Last active January 10, 2022 00:34
A handy shell script to use as a starting point if you need to setup something that only fires on x days of the week.
#!/bin/bash
###############################################################################
# A handy starting point if you need to setup something that only fires on x #
# days of the week. #
###############################################################################
DAYNUM=$(date +"%u")
if [ $DAYNUM -eq 1 ]; then
echo "It's Monday"
#!/usr/bin/env bash
# Usage: {script} [ OPTIONS ] TARGET VERSION
#
# TARGET Default target is "/usr/local".
# VERSION If not defined tries to get the build into the Sublime Text 2 website.
#
# OPTIONS
#
# -h, --help Displays this help message.
#
@bmcculley
bmcculley / SyntaxTester.java
Created March 11, 2015 21:34
jsyntaxpane example
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.WindowConstants;
import jsyntaxpane.DefaultSyntaxKit;
@bmcculley
bmcculley / convert.sh
Created March 18, 2015 23:09
convert from mp4 to mp3
#!/bin/bash
for song in *.mp4
do
title=`echo "$song" | sed -e "s/.mp4$//g"`
ffmpeg -i "$song" -vn -ar 44100 -ac 2 -ab 192k -f mp3 "$title.mp3"
done
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.python.core.*;
import org.python.util.PythonInterpreter;
public class Document extends JFrame implements ActionListener
{
private JTextArea ta;
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import subprocess
def sendmessage(message):
subprocess.Popen(['notify-send', message])
return
sendmessage('Hello OSD This is my first programmatic OSD notification')
class TestOSD {
public static void main(String[] args) throws Exception{
String[] cmd = { "/usr/bin/notify-send",
"-t",
"10000",
"Hello OSD This is my first programmatic OSD notification"};
System.out.println("This is said : Hello OSD");
Runtime.getRuntime().exec(cmd);
}
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
import com.jcraft.jsch.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.util.Scanner;
public class cmdExec{
public static void main(String[] arg){
try{
#!/usr/bin/python
from datetime import datetime, timedelta
import sys
def timeFormatted(hoursNum):
ftime = datetime.now() + timedelta(hours=hoursNum)
return '{:%H:%M:%S}'.format(ftime)
elapse = 8
for n, i in enumerate(sys.argv):
start_row = 0
while True:
cursor = conn.cursor()
cursor.execute("SELECT item FROM items LIMIT %d,1000" % start_row)
rows = cursor.fetchall()
if not rows:
break
start_row += 1000