Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
opnchaudhary / README.md
Created November 20, 2019 08:18 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@opnchaudhary
opnchaudhary / update-alternatives
Created October 17, 2019 08:59
Set java in alternatives after manual install
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk/jdk1.8.0_144/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk/jdk1.8.0_144/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk/jdk1.8.0_144/bin/javaws" 1
@opnchaudhary
opnchaudhary / brightness.sh
Created March 6, 2019 10:59 — forked from himito/brightness.sh
Control Brightness
xrandr --output $(xrandr -q | awk '/ connected / {print $1}') --brightness 0.8
@opnchaudhary
opnchaudhary / screen-record-alias
Created February 10, 2019 10:15
Bash aliases using ffmpeg to capture desktop and webcam
# To take a screenshot screen.png:
alias screencapture='ffmpeg -f x11grab -video_size 1366x768 -i $DISPLAY -vframes 1 screen.png'
# To take a screencast screen.mkv with lossless encoding and without audio:
alias recorddesktopmkv='ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i $DISPLAY -c:v ffvhuff screen.mkv'
# To take a screencast screen.mp4 with lossy encoding and with audio:
alias recorddesktopmp4='ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i $DISPLAY -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac screen.mp4'
# To record a video webcam.mp4 from the webcam without audio
alias recordwebcamv='ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -preset ultrafast webcam.mp4'
# To record a video webcam.mp4 from the webcam with audio:
alias recordwebcamav='ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac webcam.mp4'
@opnchaudhary
opnchaudhary / install-yaourt.sh
Created January 24, 2019 03:56
install yoaurt
#!/bin/bash
cd /tmp/ && git clone https://aur.archlinux.org/package-query.git
cd package-query && makepkg -si && cd /tmp/
git clone https://aur.archlinux.org/yaourt.git
cd yaourt && makepkg -si
@opnchaudhary
opnchaudhary / .vimrc
Last active January 14, 2019 05:24
My vim configurations
" Vim Settings
filetype off
filetype plugin indent on
syntax on
set encoding=utf-8
" Pathogen load
execute pathogen#infect()
execute pathogen#helptags()
@opnchaudhary
opnchaudhary / sources.list
Last active February 20, 2016 17:17
sources.list for Ubuntu 14.04
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
# deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
@opnchaudhary
opnchaudhary / download-file-in-android.txt
Created February 15, 2016 13:19
Function to download file in android
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void downloadFile(Context context, String file, String title, String subtitle) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(file));
request.setTitle(title);
request.setDescription(subtitle);
//request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI); //to allow download while using WIFI only
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
String nameOfFile = URLUtil.guessFileName(file, null, MimeTypeMap.getFileExtensionFromUrl(file));
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, nameOfFile);
[ Handfull things ]
* I use sublime text with vintage mode active, takes your speed to next level.
* Wordpress package for submime text. There is snippet that will help you to create custom post and widget within seconds. https://github.com/purplefish32/sublime-text-2-wordpress
* Sublime linter for checking errors http://www.sublimelinter.com/
* Prepros for compiling sass compressing css and javascript. https://prepros.io/
[ Things to keep in mind ]
* Follow WordPress Coding Standards. http://codex.wordpress.org/WordPress_Coding_Standards
* Use WordPress APIs when neccesarry. http://codex.wordpress.org/WordPress_APIs
* Think about the security. http://codex.wordpress.org/Hardening_WordPress
@opnchaudhary
opnchaudhary / ffmpeg-experiment-roku
Created July 15, 2014 09:14
ffmpeg audio/video dolby
Unfortunately, our mpeg demux is having problems parsing multiple audio streams out of a file and selecting the appropriate stream to play. We will enable the parsing of multiple audio streams in the future.
There is a work around you can use today. If you have access to the content, you can strip the excess streams using a transcoding tool like ffmpeg:
% ffmpeg -i MyMultiTracAudio.m4a
....
Duration: 00:59:06.98, start: 0.000000, bitrate: 71 kb/s
Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16
Stream #0.1(eng): Data: mp4s / 0x7334706D
Stream #0.2(eng): Data: mp4s / 0x7334706D