Skip to content

Instantly share code, notes, and snippets.

@sainak
sainak / android.yml
Last active September 19, 2020 15:03
GitHub Actions workflow for android projects with telegram bots integration : This workflow can notify about pushes and builds in telegram chats and can also send apk to chats
#you need to setup 2 secrets in the repository
#1. TELEGRAM_BOT_TOKEN - get it from here: https://core.telegram.org/bots#6-botfather
#2. TELEGRAM_CHAT_ID - run /help or any other bot command from the bot chat or group and
# run this command on terminal: curl -s https://api.telegram.org/bot<token>/getUpdates | jq '.result[0].message.chat.id'
#
#> to generate a continuous apk in release add "#genapk" in yor commit message
#> to get the apk to your chat add "#genapk-chat" in yor commit message
#NOTE: in telegram messages replace line break (\n) with (%0A)
name: Android CI

#How to install PyGame on Ubuntu

sudo apt-get install libfreetype6-dev libsdl-dev libsdl-image1.2-dev\
libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev \
libavformat-dev libswscale-dev python3-dev python3-numpy
python3 -m pip install -U pygame --user
//#include<conio.h> it's not a standard library avoid it at all costs
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// function to clear screen
//https://www.sololearn.com/Discuss/1752486/what-function-i-should-use-for-clear-screen-in-c-on-codeblocks
//https://code.sololearn.com/ck9435XF9iYU/?ref=app#c
#ifdef __unix__
void clearScreen()
edit the file /etc/pulse/daemon.conf
resample-method = src-sinc-best-quality
default-sample-format = s24le
default-sample-rate = 96000
@sainak
sainak / installation.sh
Last active May 7, 2021 20:49
A gist of my adventure with arch linux
#Issues:
#1. can't browse files from kde connect devices in dolphin
#2. mounting a drve requires sudo
#and more upcoming...
########################################################################
# step 1 install arch linux on bios/mbr partitions
# boot to arch.iso
@sainak
sainak / check_github_repo_size
Last active October 14, 2020 06:11 — forked from dingzeyuli/check_github_repo_size
Check the size of a github repo before downloading
# http://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning
curl -s https://api.github.com/repos/torvalds/linux | jq '.size' | numfmt --to=iec --from-unit=1024
# output:
# "size": 1746294,
@sainak
sainak / 10-quirks.conf
Created January 2, 2021 20:23
fix msi laptop brightness changing randomly
#append this to
#/usr/share/X11/xorg.conf.d/10-quirks.conf
#Brightness changes randomly
#https://ubuntuforums.org/showthread.php?t=2314161&page=2&p=13465220#post13465220
Section "InputClass"
Identifier "Spooky Ghosts"
MatchProduct "Video Bus"
Option "Ignore" "on"
@sainak
sainak / mirrorlist
Created February 8, 2021 22:17
pacman mirrorlist
Server = https://download.nus.edu.sg/mirror/archlinux/$repo/os/$arch
Server = https://mirror.osbeck.com/archlinux/$repo/os/$arch
Server = https://asia.mirror.pkgbuild.com/$repo/os/$arch
Server = https://mirror.f4st.host/archlinux/$repo/os/$arch
Server = https://mirror.f4st.host/archlinux/$repo/os/$arch
Server = https://mirror.chaoticum.net/arch/$repo/os/$arch
Server = https://archlinux.mailtunnel.eu/$repo/os/$arch
Server = https://archlinux.uk.mirror.allworldit.com/archlinux/$repo/os/$arch
Server = https://mirror.bethselamin.de/$repo/os/$arch
Server = https://mirrors.atviras.lt/archlinux/$repo/os/$arch
@sainak
sainak / rotate.sh
Created April 16, 2021 12:43
a script to rotate screen by 180 degrees on linux
#!/bin/bash
# Location for file to save rotation state
TOGGLE=/tmp/.toggle
if [ ! -e $TOGGLE ]; then
touch $TOGGLE
xrandr -o inverted
else
rm $TOGGLE
@sainak
sainak / 50-udisks.rules
Last active May 5, 2021 11:23
udisks rules to let wheel group users mount drives without authentication
#Create the file /etc/polkit-1/rules.d/50-udisks.rules with permissions 644, and with the following contents:
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
var permission = {
// only required for udisks2:
"org.freedesktop.udisks2.filesystem-mount": YES,
"org.freedesktop.udisks2.encrypted-unlock": YES,
"org.freedesktop.udisks2.eject-media": YES,
"org.freedesktop.udisks2.power-off-drive": YES,