Skip to content

Instantly share code, notes, and snippets.

View ashrafuzzaman's full-sized avatar

A.K.M. Ashrafuzzaman ashrafuzzaman

View GitHub Profile
@ashrafuzzaman
ashrafuzzaman / default.pa
Last active March 31, 2022 10:33
Ubuntu mic noise cancelling
$ sudo vim /etc/pulse/default.pa
## Append the following
=================================================================================================================
### Enable Echo/Noise-Cancelation
.ifexists module-echo-cancel.so
load-module module-echo-cancel aec_method=webrtc source_name=echocancel sink_name=echocancel1
set-default-source echocancel
set-default-sink echocancel1
.endif
@ashrafuzzaman
ashrafuzzaman / gist:d16a4f3d66f9090447624e1072458f92
Last active November 29, 2022 12:35
Camlink 4k in Ubuntu 20.04`
# Reference
1. https://askubuntu.com/questions/1356207/cam-link-4k-was-working-but-now-it-isnt
2. https://askubuntu.com/questions/1245212/how-do-i-automatically-run-modprobe-v4l2loopback-on-boot
$ sudo echo "modprobe v4l2loopback max_buffers=2 devices=1 exclusive_caps=1" >> /etc/modules-load.d/v4l2loopback.conf
$ ffmpeg -f v4l2 -framerate 50 -pix_fmt yuyv422 -video_size 1920x1080 -i /dev/video1 -f v4l2 -vcodec rawvideo -pix_fmt yuv420p /dev/video0
sudo apt update
sudo apt install -y snapd vim openvpn
sudo snap install docker
sudo groupadd docker
sudo usermod -aG docker ${USER}
sudo snap install code --classic
sudo snap install slack --classic
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
@ashrafuzzaman
ashrafuzzaman / num-of-watchers.sh
Last active February 26, 2020 09:30
inotify-consumers
#!/bin/sh
# Get the procs sorted by the number of inotify watchers
#
# From `man find`:
# %h Leading directories of file's name (all but the last element). If the file name contains no slashes (since it
# is in the current directory) the %h specifier expands to `.'.
# %f File's name with any leading directories removed (only the last element).
lines=$(
find /proc/*/fd \
@ashrafuzzaman
ashrafuzzaman / docker-compose.yml
Last active April 17, 2019 18:19
A docker composer with elasticsearch and kibana
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.0
container_name: es
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@ashrafuzzaman
ashrafuzzaman / ssh_tunnel
Created February 15, 2018 11:23
Use ssh tunnel to query asset elastic search
ssh -nNT -L 9201:vpc-production-assets-v6-lwgs7pt5lnoriviryns2ic7iqu.us-east-1.es.amazonaws.com:80 ashrafuzzaman@172.27.112.21
@ashrafuzzaman
ashrafuzzaman / promise-each.js
Created January 8, 2018 06:21
Promise each
'use strict';
const Promise = require('bluebird');
let _updateResults = () => {
let promises = [];
for (let offset = 0; offset < 10; offset += 1) {
promises.push(new Promise(resolve => _updateResultsInChunk(offset).then(resolve)));
CREATE EXTERNAL TABLE events (
name string,
user string,
variation string,
referrer string,
timestamp string,
metadata string
)
ROW FORMAT serde 'org.openx.data.jsonserde.JsonSerDe'
with serdeproperties ( 'paths'='name, user, variation, referrer, timestamp, metadata' )
CREATE EXTERNAL TABLE IF NOT EXISTS sampledb.widget_access_log (
`date` date,
`time` string,
`location` string,
`bytes` int,
`request_ip` string,
`method` string,
`host` string,
`uri` string,
`status` int,
@ashrafuzzaman
ashrafuzzaman / bootstrap.sh
Last active May 17, 2017 05:06
Git scripts
myssid=$(iwgetid -r)
if [[ $myssid == "NewsCred Inc" ]]; then
echo "In office"
/bin/bash -l -c '/home/jitu/Software/pycharm/bin/pycharm.sh' %f &
gnome-terminal --maximize --working-directory=/home/jitu/projects/marketingplatform
else
echo "Out of office"
fi