Skip to content

Instantly share code, notes, and snippets.

View k14i's full-sized avatar

kt k14i

View GitHub Profile
@k14i
k14i / bash_exe_-c_sudo_usr_sbin_sshd_-d.ps1
Created February 8, 2017 13:40
A script to run sshd of Bash on Windows quietly at the Windows starting up with a shortcut.
Set-ExecutionPolicy RemoteSigned -Scope Process
Set-Location C:\Windows\System32
Start-Process -FilePath bash -ArgumentList "-c `"sudo /usr/sbin/sshd -D`"" -WindowStyle hidden
@k14i
k14i / delete_dropbox-conflicted-copies.sh
Created August 10, 2013 17:32
Delete all conflicted copies on your Dropbox.
#!/usr/bin/env bash
DROPBOX_PATH="$HOME/Dropbox"
PREEXEC='sudo'
DUSTBOX='/tmp/rm'
DELETE_METHOD="$PREEXEC mv {} $DUSTBOX"
mkdir -p $DUSTBOX
$PREEXEC find $DROPBOX_PATH -name '*conflicted copy*' -exec $DELETE_METHOD \;
@k14i
k14i / cloudstack.sh
Last active January 11, 2020 22:56
CloudStack API client shell script.
#!/usr/bin/env bash
ADDRESS="https://"
API_KEY=""
SECRET_KEY=""
USE_XMLLINT=0 # true => 1, false => 0
if [ x$ADDRESS == x ] || [ x$API_KEY == x ] || [ x$SECRET_KEY == x ] || [ x$USE_XMLLINT == x ]; then
echo 'ERROR: Set all required valiables.'
exit 1
@k14i
k14i / aa.sh
Created August 10, 2013 18:28
Convert an image file into an ascii art and show it in the terminal. This script requires netpbm.
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
exit 1
fi
filetype=`file -b "$1" | awk '{print $1}'`
if [ x$filetype == x ]; then
msg="ERROR: Could not determine the file type of \"$1\""
@k14i
k14i / etc-init.d-dropbox-debian
Last active January 11, 2020 22:56
An /etc/init.d script for dropbox on Debian.
#!/usr/bin/env bash
# dropbox service
DROPBOX_USERS="" # space-separated usernames
DAEMON=.dropbox-dist/dropbox
NICE=19 # -20 - 19
IONICE_CLASS=3 # 0 - 3
IONICE_PRIOR=7 # 0 - 7
KERNEL=`uname -s`
@k14i
k14i / cloud-client-ui.sh
Created August 25, 2013 16:02
A /etc/init.d script for starting/stopping CloudStack Client UI.
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: cloud-client-ui
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
#!/usr/bin/env python
#
# Init script skeleton for Python-based service control scripts
#
# chkconfig: 123456 1 99
# description: My service
#
# Author: Josh Johnson <lionface dot lemonface at gmail dot com>
#
#