Skip to content

Instantly share code, notes, and snippets.

View synsa's full-sized avatar

Steve Lang synsa

View GitHub Profile
@synsa
synsa / mysql2sqlite.sh
Created May 29, 2020 06:05 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@synsa
synsa / openproject.conf
Created April 29, 2020 19:33 — forked from seLain/openproject.conf
nginx config for openproject
# assume :
# - openproject installed in /opt/openproject
# - local port: 6000
# - external port: 6020
server {
listen 6020;
server_name SERVER_DOMAIN_NAME;
root /opt/openproject/public;
@synsa
synsa / gateway_deploy.rb
Created April 13, 2020 21:59 — forked from peterhellberg/gateway_deploy.rb
Capistrano deploy via gateway host
set :user, 'username'
set :gateway, 'example.com'
set :ssh_options, {
user: fetch(:user),
forward_agent: false,
proxy: Net::SSH::Proxy::Command.new(
"ssh -l #{fetch(:user)} #{fetch(:gateway)} -W %h:%p"
)
}
@synsa
synsa / SSL-certs-OSX.md
Created March 27, 2020 18:38 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@synsa
synsa / deploy.sh
Created March 27, 2020 10:59 — forked from ctrlaltdylan/deploy.sh
Deploying Wordpress with Ansible
ansible-playbook playbook.yml -i hosts.yml -u ubuntu
@synsa
synsa / slack.sh
Created March 16, 2020 20:55 — forked from andkirby/slack.sh
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.githubusercontent.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@synsa
synsa / cli.rb
Created March 12, 2020 22:58 — forked from mattheworiordan/cli.rb
Thor with subcommands that work correctly with help
#!/usr/bin/env ruby
require 'thor'
class SubCommandBase < Thor
def self.banner(command, namespace = nil, subcommand = false)
"#{basename} #{subcommand_prefix} #{command.usage}"
end
def self.subcommand_prefix
@synsa
synsa / asdf_latest.rb
Created March 2, 2020 05:50 — forked from dre-hh/asdf_latest.rb
asdf_latest
#!/usr/bin/env ruby
require 'optparse'
require 'pry'
class Latest
def initialize(lang, distros)
@lang, @distros = lang, distros
@distros = [@lang] unless distros
@synsa
synsa / ircbot.js
Created March 2, 2020 03:49 — forked from yeonwoonj/ircbot.js
super simple IRC bot (node.js)
var os = require('os');
var net = require('net');
// config
var con = net.createConnection(6667,'irc.freenode.net');
var nick = '__YOURNICK__';
var chan = '#__YOURCHANNEL__';
var chatlogs = [];