Skip to content

Instantly share code, notes, and snippets.

View noamtamim's full-sized avatar

Noam Tamim noamtamim

View GitHub Profile
@noamtamim
noamtamim / ghpush.sh
Last active September 18, 2015 19:49
#!/bin/bash
# Simple GitHub push (https://developer.github.com/v3/repos/contents/#create-a-file)
# Mandatory arguments, as env vars:
# INPUT_FILE: local file to upload
# REPO_FULL_NAME: username/reponame
# REPO_PATH: full target path name (path/to/targetFile.txt)
# GH_TOKEN: an oauth2 access token (https://github.com/settings/tokens)
g1
@noamtamim
noamtamim / SelfExpiringHashMap.java
Created September 4, 2017 11:23 — forked from pcan/SelfExpiringHashMap.java
SelfExpiringHashMap - a Java Map which entries expire automatically after a given time; it uses a DelayQueue internally.
/*
* Copyright (c) 2017 Pierantonio Cangianiello
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@noamtamim
noamtamim / docx2md.md
Last active February 19, 2018 20:37 — forked from jesperronn/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

#!/bin/bash
<< ////
The script creates 'licenses' under '$ANDROID_HOME' and creates a file which proves
that the SDK license was accepted by the user.
Please copy this to your own account/gist/server. Every time there's an updated license, update the file with the new
license hash.
Legally if you run this script (or your own version of it), it means YOU accepted the license - don't trust someone else.
The hashes below are supposed to be taken from $ANDROID_HOME/licenses/android-sdk-license on YOUR machine, after you
@noamtamim
noamtamim / mp4-to-mp3.md
Created May 15, 2019 20:11
Convert mp4 files to mp3 (extract audio from mp4)

Convert mp4 files to mp3 (extract audio from mp4)

Assuming a simple mp4 with one video stream and one audio stream.

for f in *.mp4
do 
  ffmpeg -i "$f" "${f%mp4}mp3"
done
@noamtamim
noamtamim / README.md
Last active April 21, 2024 20:32
Markdown with PlantUML

How to use PlantUML with Markdown

PlantUML is a really awesome way to create diagrams by writing code instead of drawing and dragging visual elements. Markdown is a really nice documentation tool.

Here's how I combine the two, to create docs with embedded diagrams.

Step 0: Setup

Get the command-line PlantUML from the download page or your relevant package manager.

@noamtamim
noamtamim / docker-compose.yml
Created November 29, 2019 14:36
Simple Prometheus Docker Compose setup
version: '3.7'
volumes:
prometheus_data: {}
# Setup:
# The app root directory contains an "etc" subdir with the config files required by all containers.
# Docker Compose creates an internal network for all containers so they can call each other by name.
services: