Skip to content

Instantly share code, notes, and snippets.

@imranansari
imranansari / Fork.java
Created September 10, 2018 19:17 — forked from kevinsawicki/Fork.java
Forks a repository using API v3
import java.io.IOException;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
public class Fork {
public static void main(String... args) throws IOException {
GitHubClient client = new GitHubClient();
@imranansari
imranansari / tutorial.md
Created July 17, 2018 18:08 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

@imranansari
imranansari / build.gradle
Created July 11, 2018 19:03 — forked from TurekBot/build.gradle
Gradle Shadow Example
group 'com.github.yourusername'
version '1.0-SNAPSHOT'
//These are dependencies that have to do with just the build. See: https://stackoverflow.com/a/23627293/5432315
buildscript {
repositories {
jcenter()
}
dependencies {
//This is necessary to use the gradle shadow plugin
@imranansari
imranansari / walk generator
Created July 6, 2018 07:49 — forked from sethamclean/walk generator
filepath.walk go routine generator
package main
import (
"path/filepath"
"fmt"
"os"
)
func main(){
location := "../gocode/"
@imranansari
imranansari / asciidoc-syntax-quick-reference.adoc
Last active May 22, 2018 15:49 — forked from mojavelinux/asciidoc-syntax-quick-reference.adoc
AsciiDoc Syntax Quick Reference (sample document)

AsciiDoc Syntax Quick Reference

@imranansari
imranansari / convert-svn-to-git.sh
Created March 21, 2018 20:03 — forked from aheritier/convert-svn-to-git.sh
Script used at eXo to convert various SVN projects to Git. You can reuse some of its content but you won' be able to run it with others eXo SWF scripts.
#!/bin/bash -eu
# Load SWF functions
source /home/swfcommons/bin/swfcommons-functions.sh
# Initialize our script
swf_init_script $0
swf_init_var
# Get config (use this for environment specific settings)
swf_load_env
@imranansari
imranansari / remove-docker-containers.md
Created March 1, 2018 15:28 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@imranansari
imranansari / Makefile
Created February 8, 2018 03:39 — forked from mpneuried/Makefile
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@imranansari
imranansari / jenkins-git-backup.sh
Created February 4, 2018 17:04 — forked from choldrim/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
set -ex
if [ $# -ne 3 ]; then
echo usage: $0 jenkins_home git_repos_url git_repos_name
exit 1
fi
@imranansari
imranansari / jenkins-git-backup.sh
Created February 4, 2018 16:59 — forked from abayer/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master