Skip to content

Instantly share code, notes, and snippets.

View BhanukaUOM's full-sized avatar
🎯
Focusing

Bhanuka Rathnayaka BhanukaUOM

🎯
Focusing
View GitHub Profile
@BhanukaUOM
BhanukaUOM / logitech-m557.sh
Last active July 26, 2021 20:56
Ubuntu Logitech M557 Additional key Programming
sudo apt-get install -y xbindkeys xautomation x11-utils
xbindkeys --defaults > $HOME/.xbindkeysrc
echo "
# Back
\"xte 'keydown Alt_L' 'keydown Control_L' 'keydown Up' 'keyup Up' 'keyup Control_L' 'keyup Alt_L'\"
b:8
# Forward
@BhanukaUOM
BhanukaUOM / gitlab_cloner.sh
Last active October 8, 2020 12:11
Clone all GitLab Projects
#!/bin/bash
user=""
token=""
repo_list=$(curl "https://gitlab.com/api/v4/users/${user}/projects?per_page=1000&access_token=${token}" | jq .[].ssh_url_to_repo | sed -e 's/^"//' -e 's/"$//')
for repo in $repo_list
do
@BhanukaUOM
BhanukaUOM / compress_jpg.sh
Created August 5, 2020 06:19
Compress Images Recursively Ubuntu
find . -name '*.jpg' -type f -exec bash -c 'convert -quality 50 "$0" "$0"' {} \;
@BhanukaUOM
BhanukaUOM / setup.sh
Last active February 11, 2021 16:08
Config Dev Env in Ubuntu
sudo mv /etc/apt/sources.list /etc/apt/sources.list.backup
sudo echo "# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirror.0x.sg/ubuntu/ focal main restricted
# deb-src http://mirror.0x.sg/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirror.0x.sg/ubuntu/ focal-updates main restricted
# deb-src http://mirror.0x.sg/ubuntu/ focal-updates main restricted
@BhanukaUOM
BhanukaUOM / .wslconfig
Last active August 3, 2020 17:01
Limit WSL2 Resource Usage
[wsl2]
memory=1GB
processors=4
swap=2GB
localhostForwarding=true
<powershell>
Set-MpPreference -DisableRealtimeMonitoring $true
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y microsoft-edge notepadplusplus git nodejs-lts vscode filezilla vlc python winrar putty keepass xdm jq wget openoffice raidrive
</powershell>
import sys
import time
import json
import boto3
import pyperclip
from retrying import retry
lightsail_client = boto3.client('lightsail')
instance_name = 'My-Instance'
instance_snapshot_name = 'My-Instance-Snapshot'
@BhanukaUOM
BhanukaUOM / convert_ts_to_mp4.py
Last active September 14, 2023 12:50
Convert all ts videos to mp4
import moviepy.editor as moviepy
import glob, os
files = []
for file in glob.glob('*.ts'):
files.append(file)
for file in glob.glob('**/*.ts'):
files.append(file)
for file in glob.glob('**/**/*.ts'):
files.append(file)
@BhanukaUOM
BhanukaUOM / robot.py
Created March 21, 2018 16:21
Emotional Robot
import RPi.GPIO as GPIO
import time
import speech_recognition as sr
import picamera, subprocess, os, sys
import threading
C_DATA = 23
C_STORE = 24
C_SHIFT = 25
R_DATA = 14