Skip to content

Instantly share code, notes, and snippets.

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

Ariel Sperduti asperduti

🏠
Working from home
View GitHub Profile
@asperduti
asperduti / android-adb-pull-apk.md
Created November 17, 2021 10:39 — forked from ctrl-freak/android-adb-pull-apk.md
Retrieve APK from Non-Rooted Android Device through ADB

https://stackoverflow.com/a/18003462/348146

None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name (this may vary with the version of Android OS). The following sequence of commands is what worked for me on a non-rooted device:

  1. Determine the package name of the app, e.g. com.example.someapp. Skip this step if you already know the package name.

    adb shell pm list packages

    Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can't recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.

@asperduti
asperduti / gist:588890af04577cb7255606bcfc04d073
Created November 1, 2021 19:31
Recursively replace a string with sed
find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/old_string/new_string/g'
@asperduti
asperduti / How to stream to Facebook Live with FFmpeg.sh
Last active October 13, 2021 17:33
Command-line to stream to Facebook live with FFmpeg. Specifications for Live on Facebook: https://www.facebook.com/business/help/162540111070395?id=1123223941353904
ffmpeg -re -y -i input_file.mp4 -c:a copy -ac 1 -ar 44100 -b:a 96k -vcodec libx264 -pix_fmt yuv420p -vf scale=1080:-1 -r 30 -g 60 -tune zerolatency -f flv -maxrate 2000k -preset veryfast "rtmps://live-api-s.facebook.com:443/rtmp/$KEY"
@asperduti
asperduti / single-page-app.html
Created May 3, 2020 00:35
This is an example to show how simple it can be to implement a Single Page App(SPA) and how to use AJAX to make a request to the server and how to use the HTML5 History API to manipulate the browser’s history. This example is taken from "CS50’s Web Programming with Python and JavaScript"
<html>
<head>
<script>
document.addEventListener('DOMContentLoaded', () => {
// Start by loading first page.
load_page('first');
// Set links up to load new pages.
document.querySelectorAll('.nav-link').forEach(link => {
@asperduti
asperduti / updateExifGPS.sh
Last active December 22, 2018 21:28
Bash command to set GPS metadata
exiftool -XMP:GPSLatitude=41.3825 -XMP:GPSLongitude=2.176944 -P -overwrite-original *.jpg
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
@asperduti
asperduti / setDateCreated.sh
Last active June 10, 2018 18:04
Set date created/modified of a files in directory with the date in its name
for f in *.jpg; do filename=$(echo $f | cut -d'.' -f 1); date=$(echo $filename | cut -d'_' -f 2)$(echo $filename | cut -d'_' -f 3); date=$(echo $date | cut -c1-12);echo $date; touch -t $date "$f"; done
@asperduti
asperduti / changeHostname.sh
Created May 16, 2018 19:00
Customizing hostname for a network
nmcli con modify "NETWORK_NAME" ipv4.dhcp-hostname "CUSTOM_HOSTNAME"
exiftool "-datetimeoriginal<filename" -d "IMG_%Y%M%D-%H%M%S.%%e" ./
@asperduti
asperduti / docx2md.md
Created April 10, 2018 22:57 — forked from aembleton/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