Skip to content

Instantly share code, notes, and snippets.

View mbround18's full-sized avatar
😍
Designing

Michael mbround18

😍
Designing
View GitHub Profile
@mbround18
mbround18 / .bashrc
Last active October 14, 2022 04:02
Personal bashrc
#--------------------------------------------------------------------------------------------
# if found on gist use `git clone https://gist.github.com/650d59476b86fbe885e66af953099006.git .`
# this is a modified version of Emmanuel Rouat [no-email] bashrc how to which can be found at
# `http://tldp.org/LDP/abs/html/sample-bashrc.html`
#--------------------------------------------------------------------------------------------
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
#-------------------------------------------------------------
@mbround18
mbround18 / gist:b2b1f6477cafb07fa769cbffa95b7dda
Created May 3, 2016 00:31 — forked from RiANOl/gist:1077760
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv
#!/bin/bash -e
# This will download files or set the hosts file to defaults.
# USAGE:
# DESCRIPTION OF ENV VARS HERE
###############################################################################
set -e # exit on command errors (so you MUST handle exit codes properly!)
set -o pipefail # capture fail exit codes in piped commands
#set -x # execution tracing debug messages
# get switches
@mbround18
mbround18 / app.rb
Created June 16, 2016 23:10 — forked from hendrikswan/app.rb
sample sinatra mongodb service
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
@mbround18
mbround18 / convert-UNIX-timestamp.js
Created October 10, 2016 04:03 — forked from kmaida/convert-UNIX-timestamp.js
Convert a UNIX timestamp to user's local time via JavaScript
function convertTimestamp(timestamp) {
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
yyyy = d.getFullYear(),
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.
dd = ('0' + d.getDate()).slice(-2), // Add leading 0.
hh = d.getHours(),
h = hh,
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.
ampm = 'AM',
time;
@mbround18
mbround18 / TestRail-Slack-bot.rb
Last active June 25, 2023 07:53
TestRail notification to Slack
require 'slack-ruby-client' # You will need to install the slack-ruby-client gem
require 'faye/websocket' # you will need to install the faye-websocket gem
require 'midi-smtp-server' # you will need to install the midi-smtp-server gem
require 'mail' # you will need to install the mail gem
class TestRailInterceptor < MidiSmtpServer::Smtpd
Slack.configure do |config|
config.token = ENV['SLACK_API_TOKEN'] # this in an environment variable and add in your Slack Api token for the bot desired
end
function 7zundo() {
7z l $1 | awk ' {print $6} ' | awk '
function basename(file) {
sub(".*/", "", file)
return file
}
{print basename($1)} ' | xargs rm -rf
}
jenkins:
user.present:
- fullname: Jenkins
- shell: /bin/bash
- home: /home/jenkins
/home/jenkins/.bashrc:
file.managed:
- source: salt://defconf/bash_related/bashrc_base.conf
- mode: 644
- user: jenkins
using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace str { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { MySql.Data.MySqlClient.MySqlConnection connect; string MyconnetString; MyconnetString = "server=" + textBox1.Text + ";port=" + textBox2.Text + ";Database=" + textBox3.Text + ";uid=" + textBox4.Text + ";pwd=" + textBox5.Text +"; "; try { connect = new MySql.Data.MySqlClient.MySqlConnection(); connect.ConnectionString = MyconnetString; connect.Open(); if (connect .State == ConnectionState.Open ) { button1.ForeColor = Color.Green; MessageBox.Show("Good"); } connect.Close(); // Thank all ): } catch (MySql.Data.MySqlClient.MySqlException ex) { MessageBox.Show(ex.Message ); } } } }
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name server_domain_or_IP;
include /etc/nginx/additional_conf.d/header_options.conf;