Skip to content

Instantly share code, notes, and snippets.

View synsa's full-sized avatar

Steve Lang synsa

View GitHub Profile
@synsa
synsa / gtran.sh
Created August 20, 2018 21:11
Console Google Translate (bash + curl + sed)
#! /bin/bash
### Console Google Translate
### Example usage:
### gtran.sh en fr lovely spam
USAGE="Usage:
$0 en es Lovely spam!
Some codes: en|fr|de|ru|nl|it|es|ja|la|pl|bo
All language codes:
@synsa
synsa / .htaccess
Created August 21, 2018 20:34 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@synsa
synsa / ca.md
Created September 11, 2018 08:37 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@synsa
synsa / testing a ruby gem.md
Created September 12, 2018 00:04 — forked from Integralist/testing a ruby gem.md
Testing a Ruby Gem

Version 1

# Long way of doing things (new files need to be added to staging area *before* building the gem)
git add . && gem build my_gem.gemspec && gem install my_gem-0.0.0.gem

Version 2

@synsa
synsa / laravel_deploy.sh
Created September 12, 2018 02:29
Laravel 5 deployment via rsync.
#!/bin/bash
# Application Deployer
# @author: @IAmReliQ
# @link: https://gist.github.com/reliq/75dc97a713982150b18d1825a907be4f
#
#
# Input:
# $1 - Server to deploy to
# $2 - Remote user home
# $3 - Remote username
@synsa
synsa / slack.sh
Created September 12, 2018 23:16 — forked from miguelmota/slack.sh
Slack post message with cURL
TOKEN="xoxp-abc"
CHANNEL="some-channel"
TEXT="hello"
curl -X POST "https://slack.com/api/chat.postMessage" -d "token=$TOKEN&channel=$CHANNEL&text=$TEXT"
@synsa
synsa / terminal-git-branch-name.md
Created September 18, 2018 19:10 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
/**
* Escapes the inserted value for LDAP.
*
* @param string $value The value to escape
* @param string $ignore The characters to ignore
* @param int $flags The PHP flag to use
*
* @return bool|string
*/
public function escapeManual($value, $ignore = '*', $flags = 0)
@synsa
synsa / SlackPostMessageWithAttachments.js
Created September 24, 2018 22:32 — forked from pdtyreus/SlackPostMessageWithAttachments.js
Slack chat.postMessage with attachments
var http = require("https");
var querystring = require('querystring');
//2 attachments as JavaScript Objects
var attachments = [{
fallback: "Attachment 1 Fallback",
title: "This is Attachment 1",
text: "Attachment 1 Text",
color: "#3964db"
}, {