Skip to content

Instantly share code, notes, and snippets.

View AnwarShah's full-sized avatar

Anwar AnwarShah

View GitHub Profile
@AnwarShah
AnwarShah / ffmpeg.md
Created July 20, 2019 11:26 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@AnwarShah
AnwarShah / theme_looper.rb
Created September 15, 2018 18:19
Change GTK theme once per minute
#!/usr/bin/ruby
themes_dir = Dir["/usr/share/themes/*"].select do |entry|
File.directory?(entry) && File.exists?(entry + "/index.theme") && File.exist?(entry + "/gtk-3.0")
end.sort!
theme_names = themes_dir.sort.map { |dir| File.basename(dir) }
theme_names.each do |theme_name|
sleep 60 # 60 is 1 minute. Change it according to your need.
@AnwarShah
AnwarShah / favoriate-gnome-shell-extensions
Last active February 28, 2020 13:31
My favorite gnome shell extensions
Clipboard indicator - https://extensions.gnome.org/extension/779/clipboard-indicator/
CustomCorner - https://extensions.gnome.org/extension/1037/customcorner/
Dash to Dock - https://extensions.gnome.org/extension/307/dash-to-dock/
Dash to Panel - https://extensions.gnome.org/extension/1160/dash-to-panel/
Do Not Disturb Button - https://extensions.gnome.org/extension/964/do-not-disturb-button/
Extensions - https://extensions.gnome.org/extension/1036/extensions/
gistnotes - https://extensions.gnome.org/extension/917/gistnotes/
Hide Top Bar - https://extensions.gnome.org/extension/545/hide-top-bar/
Gnome-Prefs Button - https://extensions.gnome.org/extension/1054/gnome-prefs-button/
Impatience - https://extensions.gnome.org/extension/277/impatience/
@AnwarShah
AnwarShah / 99-autohint-opentype.conf
Created February 25, 2018 05:30
Enable autohint for open type fonts since default hinting looks blurry
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- enable autohint for open type fonts -->
<match target="font">
<test name="fontformat">
<string>CFF</string>
</test>
<edit name="autohint" mode="assign">
@AnwarShah
AnwarShah / 99-replace-thin.conf
Created February 25, 2018 04:02
Replace thin fonts with ultralight using fontconfig
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- replace thin fonts for fira with ultralight, since thin is too light -->
<match target="font">
<test name="family" compare="contains">
<string>Fira Sans</string>
</test>
<test name="weight" compare="less_eq">
@AnwarShah
AnwarShah / gsm-setup.md
Created May 16, 2017 15:46 — forked from heyalexej/gsm-setup.md
SIM Card Management Through GSM Modem On Linux

SIM Card Management Over GSM Modem

A small guide on how to send and receive USSD codes on Linux

I am using the built in GSM (UMTS) modem of my Thinkpad X1 extensively because I am often in places with flaky internet connections. I connect through the standard Network Manager on Ubuntu and everything works fine. There was one major annoyance though. Every time I wanted to top up the SIM balance or book a new package, I needed a phone to send and receive USSD codes. So I took some time to figure out how to do it from the shell. I wrote this down as a help for others and a reminder for myself. Without further ado...

First intsall gammu and picocom.

~  sudo apt-get install -y gammu picocom
@AnwarShah
AnwarShah / ppas.list
Created April 20, 2017 06:21
My Xenial Xerus 16.04 PPA list
deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /
deb http://ppa.launchpad.net/docky-core/stable/ubuntu xenial main
deb http://ppa.launchpad.net/elementary-os/stable/ubuntu xenial main
deb http://ppa.launchpad.net/embrosyn/cinnamon/ubuntu xenial main
deb http://ppa.launchpad.net/fontforge/fontforge/ubuntu xenial main
deb http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial main
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
deb https://cli-assets.heroku.com/branches/stable/apt ./
@AnwarShah
AnwarShah / jdk_download.sh
Created April 12, 2017 16:14 — forked from P7h/jdk_download.sh
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@AnwarShah
AnwarShah / rspec_rails_cheetsheet.rb
Created February 21, 2017 19:35 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)