Skip to content

Instantly share code, notes, and snippets.

@azam
azam / settings.json
Created Jan 16, 2017
Visual Studio Code User Settings
View settings.json
{
"editor.renderControlCharacters": true,
"editor.renderWhitespace": "all",
"editor.fontFamily": "Ricty Diminished",
"editor.fontSize": 12,
"editor.lineHeight": 12,
"window.zoomLevel": 0
}
@azam
azam / Dockerfile
Last active Jan 12, 2017
Dockerfile for create-react-app, since I don't want to polute my node global modules. Creates a temporary project on build and removes it afterward, to cache the latest packages on build-time. Build: `docker build -t azam/create-react-app`. Usage: `docker run --rm -v $PWD:/project azam/create-react-app my-project-name`
View Dockerfile
FROM node:6-alpine
RUN npm install -g create-react-app \
&& mkdir /project \
&& cd /project \
&& /usr/local/bin/create-react-app tmp-project \
&& rm -rf ./tmp-project
WORKDIR /project
ENTRYPOINT ["/usr/local/bin/create-react-app"]
@azam
azam / .profile
Last active Jan 5, 2017
Common bash profile for macOS
View .profile
### prep a dir for git with github sane defaults
### usage: gitprep ulidj azam/ulidj
gitprep() {
if [ -z "$2" ]
then
echo "gitprep: illegal arguments"
echo "usage: gitprep [dirname] [reponame]"
return -1
else
mkdir $1
@azam
azam / Dockerfile
Created Nov 18, 2016
DynamoDB Local with Java8 on Alpine. Example: docker run -p 18000:8000 -v /Users/me/ddb/data:/dynamodb/data azamshul/dynamodb-local:latest
View Dockerfile
FROM anapsix/alpine-java:8
RUN apk --no-cache add --update curl \
&& mkdir /dynamodb \
&& mkdir /dynamodb/bin \
&& cd /dynamodb/bin \
&& /usr/bin/curl -L http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest | /bin/tar xz \
&& apk del curl
EXPOSE 8000
WORKDIR /dynamodb/data
ENTRYPOINT ["java", "-Djava.library.path=/dynamodb/bin/DynamoDBLocal_lib", "-jar", "/dynamodb/bin/DynamoDBLocal.jar", "-port", "8000", "-dbPath", "/dynamodb/data"]
@azam
azam / gist4sites.xml
Last active Feb 7, 2020
Gadget to embed gist on Google Site. Use this url as gadget URL when inserting to a Google Site page: https://cdn.rawgit.com/azam/2e35a393ee2425f40c6d04de4ce5926b/raw/5389dc5ce442eca1c517cfe12132a0b90553e965/gist4sites.xml
View gist4sites.xml
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Google Sites Gist Module">
<Require feature="dynamic-height"/>
</ModulePrefs>
<UserPref name="gistId" display_name="Gist #" required="true" />
<UserPref name="baseUrl" display_name="Base URL" required="false" default_value="https://gist.github.com"/>
<Content type="html">
<![CDATA[
<div id="content_div"><script src="__UP_baseUrl__/__UP_gistId__.js"></script><script type="text/javascript">gadgets.util.registerOnLoadHandler(gadgets.window.adjustHeight);</script></div>
@azam
azam / mvn.sh
Created Feb 29, 2016
Add custom jar as local repo
View mvn.sh
mvn install:install-file -Dfile=my-library.jar -DgroupId=io.azam -DartifactId=my-library -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true -DlocalRepositoryPath=./repo -Dsources=my-library-src.jar
@azam
azam / .profile
Last active Jan 29, 2016
Mac OSX Bash Profile
View .profile
### Java
export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
### Maven
export MAVEN_HOME="$HOME/Applications/apache-maven-3.3.3"
export M3=$MAVEN_HOME
export M3_HOME=$M3
export PATH=$PATH:$M3_HOME/bin
### Android
@azam
azam / Preferences.sublime-settings
Created Nov 22, 2015
Azam's Sublime Text 3 User Settings
View Preferences.sublime-settings
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
"draw_white_space": "all",
"rulers": [80],
"font_face": "Ricty Diminished", // https://github.com/yascentur/RictyDiminished
"font_size": 11,
"font_options": ["directwrite"],
"line_padding_top": 0,
"line_padding_bottom": 0,
@azam
azam / stack.js
Created Nov 10, 2015
Simple Javascript stack library
View stack.js
/**
* stack.js
* (c) 2015 Azamshul Azizy
*
* [description]
* @param {[type]} factory [description]
* @return {[type]} [description]
*/
(function(stackjs) {
// if (typeof(define) === "function" && typeof(define.amd) !== "undefined") {
@azam
azam / ec2jenkins.sh
Last active Sep 5, 2015
EC2 Jenkins preparation script
View ec2jenkins.sh
#!/bin/bash
# This script is intended to be run as preparation script
# during creation of ec2 instance, which is executed as root.
# So we don't need to run these commands with sudo over here.
wget https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
# NOTE: execute this 4 commands if you change repo, ie redhat to redhat-stable
# rm -f /var/lib/rpm/__db*
# rpm --rebuilddb
# yum clean all