Skip to content

Instantly share code, notes, and snippets.

View mauriciogior's full-sized avatar

Maurício Giordano mauriciogior

View GitHub Profile
@mauriciogior
mauriciogior / background.js
Created January 27, 2022 20:41 — forked from muralikg/background.js
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
@mauriciogior
mauriciogior / yt-podcast-generator.py
Created February 22, 2019 18:25
yt-podcast-generator
# -*- coding: utf-8 -*-
from feedgen.feed import FeedGenerator
from boto.s3.connection import OrdinaryCallingFormat
from boto.s3.key import Key
from boto.cloudfront import CloudFrontConnection
from os import path
import boto
import boto.s3
import sys
@mauriciogior
mauriciogior / git-pull.sh
Created January 24, 2019 03:56
git pull & push
#!/bin/bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git pull origin $branch
@mauriciogior
mauriciogior / git-delete-branch.sh
Created January 24, 2019 03:55
git-delete-branch
#!/usr/bin/env bash
# reset environment variables that could interfere with normal usage
export GREP_OPTIONS=
# put all utility functions here
# make a temporary file
git_extra_mktemp() {
mktemp -t "$(basename "$0")".XXX
}
@mauriciogior
mauriciogior / gtree
Created January 24, 2019 03:39
Beautiful git tree
git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
@mauriciogior
mauriciogior / FragmentManagerHelper.java
Created September 5, 2018 19:57
Useful helper to handle fragment manager back stack
package you.pkg.here;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
/*
* Copyright (C) 2018 InEvent, Inc. MIT License
*/
public class FragmentManagerHelper {
@mauriciogior
mauriciogior / rastertoptch.c
Last active February 20, 2018 21:10
Source code of QL-500 + (included QL-700) driver with automatic cut working.
/**
* Driver extracted from http://www.diku.dk/~panic/P-touch/.
* Modified by Mauricio Giordano <giordano@inevent.us>
*/
/**
* rastertoptch is a filter to convert CUPS raster data into a Brother
* P-touch label printer command byte stream.
*
* Copyright (c) 2006 Arne John Glenstrup <panic@itu.dk>
@mauriciogior
mauriciogior / SomeFragment.java
Created February 24, 2015 22:01
Change cursor in search view widget for AppCompat v21
// We need to use reflection...
// yes, I know, it sucks!
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_with_search, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
final EditText editTextView = (EditText) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
@mauriciogior
mauriciogior / gist:527570bab1ae55d7aa98
Last active August 29, 2015 14:13
ImageView with background fill

Example

Screenshot

There is no support for horizontal fill, just vertical.

public class ImageViewWithFill extends ImageView {

    private final int fillColor = 0xff66ffcc; // fill color
@mauriciogior
mauriciogior / LinkedInActivity.java
Last active December 19, 2018 06:41
SignIn with LinkedIn Android (retrieving email address)
import com.google.code.linkedinapi.client.LinkedInApiClient;
import com.google.code.linkedinapi.client.LinkedInApiClientFactory;
import com.google.code.linkedinapi.client.enumeration.ProfileField;
import com.google.code.linkedinapi.client.oauth.LinkedInAccessToken;
import com.google.code.linkedinapi.client.oauth.LinkedInOAuthService;
import com.google.code.linkedinapi.client.oauth.LinkedInRequestToken;
import com.google.code.linkedinapi.schema.Person;
/* DON'T FORGET TO PUT THIS ON YOUR MANIFEST:
<activity