Skip to content

Instantly share code, notes, and snippets.

View OrenBochman's full-sized avatar
🏠
Working from home

Oren Bochman OrenBochman

🏠
Working from home
  • WMF
  • 16:27 (UTC +02:00)
View GitHub Profile
@OrenBochman
OrenBochman / Calibre_remove_empty_books.sh
Created April 29, 2020 10:24 — forked from EnigmaCurry/Calibre_remove_empty_books.sh
Remove empty books from calibre (books that have no formats available)
calibredb list -f title,author_sort,formats | grep ".*\[\]\W*$" | cut -d " " -f 1 | xargs -iXX calibredb remove XX
snippet template "Basic template" b
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[dutch]{babel}
\usepackage{amsmath, amssymb}
\begin{document}
@OrenBochman
OrenBochman / gistp.sh
Created November 1, 2018 10:54 — forked from sddamico/gistp.sh
paste your clipboard to a gist and copy the gist url to the clipboard
gistp() {
if [ -z "$1" ] ; then
echo "Must supply filename for new gist"
exit(1)
else
gisturl=$(pbpaste | gist -f $1)
echo "Copying $gisturl to clipboard"
echo "$gisturl" | pbcopy
fi
}
@OrenBochman
OrenBochman / setup-java-arm.sh
Created October 24, 2018 17:52 — forked from ricardojlrufino/setup-java-arm.sh
Script to Setup JAVA (on rapberry, beaglebone, etc...)
#!/bin/bash
DFILE=`find -name "*arm*.tar.gz"`
echo "Found: " $DFILE
if [ -z "$DFILE" ]; then
echo "ERROR: Please download JRE/JDK and put in current directory"
exit 1
fi
@OrenBochman
OrenBochman / Shell.java
Created October 24, 2018 17:52 — forked from ricardojlrufino/Shell.java
Run shell comands from APP as SUDO (like start ADB)
package br.com.criativasoft.eduaccess.util;
import android.util.Log;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
@OrenBochman
OrenBochman / ADBCheatSheet.md
Created October 12, 2018 08:44 — forked from HugoMatilla/ADBCheatSheet.md
ADB Cheat Sheet

CONFIG

Include adb and other android tools on your path

In Users/hugomatilla.bash_profile add export PATH=$PATH:/Users/hugomatilla/Documents/AndroidSDKs/sdk/platform-tools export PATH=$PATH:/Users/hugomatilla/Documents/AndroidSDKs/sdk/tools

My own adb location

cd /Users/hugomatilla/Documents/AndroidSDKs/sdk/platform-tools

START

@OrenBochman
OrenBochman / Search my gists.md
Last active August 28, 2024 21:07 — forked from santisbon/Search my gists.md
How to search gists

Gist Search Cheatsheet

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:orenbochman

Find all gists with a .yml extension.
extension:yml

@OrenBochman
OrenBochman / !!Accelerating_Gradle.md
Last active September 9, 2018 09:36 — forked from kevalpatel2106/gradle.properties
Accelerating Gradle

Accelerating Gradle Builds

@OrenBochman
OrenBochman / RuntimePermissionRequest.java
Last active August 21, 2018 07:11 — forked from davidgassner/RuntimePermissionRequest
ask for permission to make a phone call on android
//Add before making a phone call
if (ActivityCompat.checkSelfPermission(
MainActivity.this, Manifest.permission.CALL_PHONE)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
Manifest.permission.CALL_PHONE)) {
Toast.makeText(MainActivity.this, "I know you said no, but I'm asking again", Toast.LENGTH_SHORT).show();
}
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CALL_PHONE},
@OrenBochman
OrenBochman / text2png.py
Created February 7, 2018 22:26 — forked from destan/text2png.py
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '