Skip to content

Instantly share code, notes, and snippets.

View subwiz's full-sized avatar

Subhash Chandran subwiz

View GitHub Profile
@subwiz
subwiz / loc.sh
Created September 27, 2017 16:40
LOC of Go packages
#!/bin/bash
# Install: https://github.com/warmans/golocc
for f in $(ls)
do
if [ -d "$f" ]; then
cd $f
golocc --no-vendor ./...
cd ..
@subwiz
subwiz / add-border.sh
Last active July 28, 2017 06:06
Imagic Magick script to add border to images. To install Imagic Magick: `brew update && brew install imagemagick`.
#!/bin/sh
for i in "$@"; do
echo Processing "$i" '=>' "x-$i"
convert "$i" -shave 5x5 -bordercolor black -border 5 "x-$i"
done
FROM debian
RUN mkdir -p /app/conf
# Assumption: Go generated project binary `prjbinary`
COPY prjbinary /app/prjbinary
COPY docker/conf/db.toml /app/conf/db.toml
# entrypoint.sh executes /app/prjbinary
# Before execution, based on MYENV, copies configs from vault to /app/conf/
@subwiz
subwiz / convert.sh
Last active January 27, 2023 03:34
Go HTTP client using pkcs12 certificate
#!/bin/sh
## First convert .p12 cert to certificate and key .pem files:
openssl pkcs12 -in cert.p12 \
-clcerts -nokeys -out usercert.pem
openssl pkcs12 -in cert.p12 \
-nocerts -out userkey.pem -nodes
# Do `gem install aws-sdk`
require 'aws'
AWS.config(:access_key_id => 'ACCESS_KEY', :secret_access_key => 'SECRET_KEY')
db = AWS::DynamoDB.new
table = db.tables['subwiz_table'].load_schema
item = table.items.create(id: "subwiz")
item.attributes.add(followers: ["Ariel", "Mermaid"])
item.attributes.add(following: ["Sunny", "Leone"])
@subwiz
subwiz / gist:dff5daccce97c57958ec
Created September 16, 2014 06:23
C# Example for Creating Freshdesk Ticket With Attachment
using System;
using System.IO;
using System.Net.Http;
namespace HttpClientFDApi
{
class FreshdeskTicketAttachmentApi
{
static void Main(string[] args)
{
@subwiz
subwiz / debug.sh
Created January 28, 2014 12:47
ShellScript
#!/bin/sh
set -vx
echo Enabled Debug