Skip to content

Instantly share code, notes, and snippets.

View baalajimaestro's full-sized avatar
🪞
This account is now a read-only mirror

Baalaji baalajimaestro

🪞
This account is now a read-only mirror
View GitHub Profile
@baalajimaestro
baalajimaestro / bbswitch.patch
Created December 29, 2020 04:38
Patch to include bbswitch inline, compatible and tested on 5.10.3
--- /dev/null 2020-12-29 08:23:57.202225942 +0530
+++ b/drivers/video/bbswitch/bbswitch.c 2020-12-26 17:53:33.867054206 +0530
@@ -0,0 +1,522 @@
+/**
+ * Disable discrete graphics (currently nvidia only)
+ *
+ * Usage:
+ * Disable discrete card
+ * # echo OFF > /proc/acpi/bbswitch
+ * Enable discrete card
@baalajimaestro
baalajimaestro / iptables-rules
Last active September 14, 2022 07:35
General iptables rules to permit wireguard, openvpn and prevent ddos
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 10.0.2.0/24 -o eth0 -j MASQUERADE
# allow established sessions to receive traffic
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# allow your application port
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -p udp --dport 443 -j ACCEPT
# allow SSH
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
# Allow Ping

Keybase proof

I hereby claim:

  • I am baalajimaestro on github.
  • I am baalajimaestro (https://keybase.io/baalajimaestro) on keybase.
  • I have a public key whose fingerprint is 2F3E 6C39 9E36 1E3B 3EAB 9714 749B 6F02 30AD E7B7

To claim this, I am signing this object:

@baalajimaestro
baalajimaestro / Just-in-case.txt
Created December 6, 2018 15:38
OS Lab Questions
OS Lab 2
1. Display your login name, date ,who is the currently logged in user and home directory
2. Display sum of two integers
3. Create a file student.txt 3 in cse 3 in mech
@baalajimaestro
baalajimaestro / random_stuff.py
Last active September 15, 2018 11:55
Some random gist k
import sys
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
LOGGER.error("You MUST have a python version of at least 3.6!")
quit(1)
from telethon import TelegramClient, events
from async_generator import aclosing
from telethon.tl.functions.channels import InviteToChannelRequest
rom telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
api_id=os.environ['API_KEY']
@baalajimaestro
baalajimaestro / somefile.java
Created September 1, 2018 12:42
Simple program In java
import java.io.*;
class Nekofuri
{
public static void main(String[] args)throws IOException
{
String str;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
str=br.readLine();
char[] A=str.toCharArray();
char B[]=new char[A.length];
@baalajimaestro
baalajimaestro / JavaFX_DrawSomething.java
Last active December 7, 2018 20:12
Can't invert y axis on javafx at all. :/
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Cursor;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
@baalajimaestro
baalajimaestro / DraggingCustom2.java
Created July 9, 2018 11:46
Simple Drag and Drop Feature implemented with Swing in Java
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;