Skip to content

Instantly share code, notes, and snippets.

.selectable {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
#!/bin/sh
echo "+--------------------------+";
echo "| Uninstalling application |"
echo "+--------------------------+";
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} adb -s {} uninstall [com.your.app/.Name]
echo "+------------------------+";
echo "| Installing application |";
echo "+------------------------+";
adb devices | tail -n +2 | cut -sf 1 | xargs -I {} adb -s {} install [path-to-apk]
echo "+----------------------+";
@mtrl
mtrl / ncftpget-recursive-download
Created July 11, 2011 11:34
ncftpget recursive download from list of dirs
#!/bin/bash
a=0
while read line
do a=$(($a+1));
echo $line;
mkdir $line;
cd $line;
ncftpget -u USER -p PASSWORD -R -d stdout -t 300 "ftp://[HOST]/$line"
cd "..";
done < "../dir-list"
@mtrl
mtrl / app.component.ts
Last active January 24, 2017 12:12
app.component.ts changes for logging
import {LoggerService} from ‘./logger-service’;
import {Logger} from “angular2-logger/core”;
@Component({
providers: [LoggerService, Logger]
})
@mtrl
mtrl / config.ts
Created January 24, 2017 12:09
sample.config.ts
export let data = {
"ApiUrl" : "http://my.dev",
"LogLevel": "DEBUG", // OFF, ERROR, WARN, INFO, DEBUG, LOG
"AnalyticsId": "UA-XXXX-XX",
"TermsBlerb": "Some TCs."
}
config.vm.provider 'virtualbox' do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end
@mtrl
mtrl / jwt-filter.php
Created November 4, 2016 12:52
jwt-filter
$this->loader->add_filter('validate_token', $plugin_public, 'validate_token’);
// Check for the existence of a header authentication token before dispatching any data
add_filter( 'rest_pre_dispatch', function() {
$requestPath = $_SERVER['REQUEST_URI'];
if($requestPath != '/wp-json/jwt-auth/v1/token') {
$tokenValidationResponse = apply_filters('validate_token', null);
if(gettype($tokenValidationResponse) == 'object' && get_class($tokenValidationResponse) == "WP_Error") {
foreach($tokenValidationResponse->error_data as $key => $error) {
$status = $error['status'];
$msg = $key;
};
@mtrl
mtrl / transcode-video-for-chromecast.sh
Last active July 22, 2016 08:38
Transcode video for Chromecast
VIDEO=[video]
ffmpeg -i $VIDEO -c:v libx264 -profile:v high -level 5 -crf 18 -maxrate 10M -bufsize 16M -pix_fmt yuv420p -vf "scale=iw*sar:ih, scale='if(gt(iw,ih),min(1920,iw),-1)':'if(gt(iw,ih),-1,min(1080,ih))'" -x264opts bframes=3:cabac=1 -movflags faststart -strict experimental -c:a aac -b:a 320k -y $VIDEO.mp4
@mtrl
mtrl / wordpress-permissions.sh
Created April 11, 2016 10:35
WordPress permissions for update
sudo chown www-data:www-data -R *
sudo find . -type f -exec chmod 775 {} \; # Change file permissions
sudo find . -type d -exec chmod 775 {} \; # Change file permissions
# Switch them back to the correct permissions:
sudo find . -type f -exec chmod 755 {} \; # Change file permissions
sudo find . -type d -exec chmod 644 {} \; # Change file permissions