Skip to content

Instantly share code, notes, and snippets.

View nikp123's full-sized avatar
🏠
Working from home

nikp123 nikp123

🏠
Working from home
View GitHub Profile
@nikp123
nikp123 / poweroff_when_unplugged.sh
Created October 7, 2017 14:17
A script that powers off your device when unplugged from the charger
#!/system/bin/sh
# Written by nikp123 2017 :D
# Powers off android when you unplug it from the charger
# Make sure busybox is installed in order this to work
while :
do
sleep 10
@nikp123
nikp123 / c.bat
Created May 9, 2018 12:43
Some goofy script that I made while in school
@echo off
echo d8, d8b d8, d8,
echo `8P 88P `8P `8P
echo d88
echo d8888b?88,.d88b, 88b888 d8888b?88,.d88b, .d888b, 88b d88 d888b8b
echo d8b_,dP`?88' ?88 88P?88 d8b_,dP`?88' ?88 ?8b, 88P ?88 d8P' ?88
echo 88b 88b d8P d88 88b 88b 88b d8P `?8b d88 88b 88b ,88b
echo `?888P' 888888P'd88' 88b`?888P' 888888P'`?888P' d88' `88b`?88P'`88b
echo 88P' 88P' )88
echo d88 d88 ,88P
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
if(argc<2) {
printf("Usage: %s outputfile\n", argv[0]);
return 1;
// COMPILE with any C++ compiler and link with SDL2
#include <iostream>
#include <vector>
#include <memory>
#include <SDL2/SDL.h>
#define WIN_HEIGHT 800
#define WIN_WIDTH 800
#!/bin/sh
while ! swaymsg -t get_tree | grep $1; do
sleep 0.1
done
swaymsg [class="$1"] kill
@nikp123
nikp123 / script.sh
Created May 7, 2020 23:56
ChatDestroyer - A script for your immoral deeds
#!/bin/sh
FILE=$1
MAX_SIZE=$2
rm x*
split -b $2 $1
sleep 1
for i in x??; do
@nikp123
nikp123 / monitor_config
Last active January 11, 2021 19:17
Changing display resolutions in sway
#!/bin/bash
swaymsg="$(swaymsg -t get_outputs -r)"
numOfModes=$(echo $swaymsg|jq -r '.[0].modes | length')
modes=''
widths="$(echo $swaymsg|jq -r '.[0].modes[].width')"
IFS=$'\n' widths=($widths)
@nikp123
nikp123 / mbr_parser.c
Created July 1, 2021 13:30
MBR partitioned disk parser
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>
#include <sys/types.h>
#include <math.h>
#define MAX_PATH 255
@nikp123
nikp123 / post_frag_soft.glsl
Created July 16, 2021 06:43
Soft-shadows XAVA post-render shader
precision mediump float;
varying vec2 v_texCoord;
uniform sampler2D s_texture;
const float pi = 3.14159265f;
const float check_steph = 0.00125;
const float check_stepv = 0.005;
// input vertex
attribute vec4 pos;
// foreground color
uniform vec4 color;
// screen width and height
uniform vec2 u_resolution;
// projection matrix precalculated by XAVA