Skip to content

Instantly share code, notes, and snippets.

@ma4a
ma4a / custom.bashrc
Created September 21, 2017 08:51
customized .bashrc
# customizations for bash command line
# alternative path /etc/bash.bashrc
# you can store this file in e.g. /etc/custom.bashrc and reference the file using 'source /etc/custom.bashrc' inside the /etc/bash.bashrc file to keep customizations at a separate place
#ALIAS commands to customize commands and create shortcuts
alias ..='cd ..'
alias app='apropos '
alias ag="sudo apt-get update && sudo apt-get install && sudo apt-get upgrade" #install all available software updates (prompt for final install decision)
alias c='clear'

Keybase proof

I hereby claim:

  • I am ma4a on github.
  • I am matze7 (https://keybase.io/matze7) on keybase.
  • I have a public key ASAyqvyXPuSJcjcto-Q47zDCWrWYE_L-wLGsdf-Zy8goOwo

To claim this, I am signing this object:

@ma4a
ma4a / printfriendly_bookmarklet.js
Last active April 16, 2025 09:56
Bookmarklet to print the current page as PDF using http://printfriendly.com service. Instead of an overlay like the official bookmarklet, this one opens a new window/popup.
javascript:(function(){window.open('http://www.printfriendly.com/print/?url='+encodeURIComponent(location.href),'_blank','menubar=no,height=900,width=750,toolbar=no,scrollbars=no,status=no,dialog=1');})();
<?php
/*
Plugin Name: Preview URL
Plugin URI: http://yourls.org/
Description: Preview URLs before you're redirected there
Version: 1.0
Author: Ozh
Author URI: http://ozh.org/
Version: 1.1
#!/bin/bash
vivaldi_url=$(curl -s https://vivaldi.com/download/ | grep -oP '(https:\/\/[a-z0-9-.\/_]*_amd64.deb)')
vivaldi_filename=$(basename $vivaldi_url)
echo "current installed version: $(vivaldi --version)";
echo "available version: $vivaldi_filename";
read -p "Download the update? [y/N]" -n 1 -r;
echo
if [[ $REPLY =~ ^[Yy]$ ]]
#!/bin/bash
#options; change if needed :)
tmpdir='/tmp/' #trailing slash needed
#don't change things below.
seafile_filename_regex='(seafile_[0-9.]{1,11}_'$platform'.deb)'
seafile_latest_version=''
seafile_deb=$tmpdir'seafile_latest.deb'
@ma4a
ma4a / AndroidHTTPPUTFileToWebservice.java
Created May 18, 2013 21:07
Code to use HTTP PUT to send an image file (png in this case) to a webservice
public static boolean putImage(Bitmap image) {
ByteArrayOutputStream baos = null;
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, APP_UA); //UserAgent
URI uri = null;
try {
uri = new URI("http://your.url.to.upload/the/file/via/PUT/123");
} catch (URISyntaxException e) {
e.printStackTrace();
}
@ma4a
ma4a / mergePNGs.php
Created May 18, 2013 21:00
Merge 2 PNG-Files without losing alpha channel transparency information
<?php
function mergePNGs($dst_fileURL, $temp_fileURL)
{
$resolutionX = 1000;
$resolutionY = 1000;
$dst_im = imagecreatefrompng($dst_fileURL) or die('Error reading image file');
$src_im = imagecreatefrompng($temp_fileURL) or die('Error reading image file');
imagealphablending($dst_im, true);
@ma4a
ma4a / onlyShowComments.php
Created May 4, 2013 12:29
Only show the comments of a referred PHP file.
<?php
function commentworker($array, $s = '<br><br>')
{
if (is_array ($array))
{
$output = '';
foreach ($array as $v)
{
$output .= commentworker($v, $s);
}
@ma4a
ma4a / raspberryPiGPIOblink.py
Created August 21, 2012 22:43
make the Raspberry Pi connected LEDs etc blink