Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Hritik14's full-sized avatar

Hritik Vijay Hritik14

View GitHub Profile
Aug 10 20:17:07 HOSTNAME sudo[1343]: USERNAME : TTY=pts/0 ; PWD=/home/USERNAME ; USER=root ; COMMAND=/usr/bin/systemctl restart systemd-logind.service
Aug 10 20:17:07 HOSTNAME sudo[1343]: pam_unix(sudo:session): session opened for user root by (uid=0)
Aug 10 20:17:07 HOSTNAME systemd[1]: Stopping Login Service...
Aug 10 20:17:07 HOSTNAME systemd[1]: Stopped Login Service.
Aug 10 20:17:07 HOSTNAME gnome-shell[741]: Could not release device 13,67: Cannot invoke method; proxy is for a well-known name without an owner and proxy was constructed with the G_DBUS_PROX
Aug 10 20:17:07 HOSTNAME systemd[1]: Starting Login Service...
Aug 10 20:17:07 HOSTNAME gnome-shell[741]: Could not release device 13,71: Cannot invoke method; proxy is for a well-known name without an owner and proxy was constructed with the G_DBUS_PROX
Aug 10 20:17:07 HOSTNAME gnome-shell[741]: Could not release device 13,72: Cannot invoke method; proxy is for a well-known name without an owner and proxy was constructed with the G_DBUS_PROX
Aug 10 2
@Hritik14
Hritik14 / route.ovpn
Created March 31, 2018 10:36
NetworkManager ip route in openVPN config
With custom routes in a custom ovpn file, NetworkManager reports with
`Error: configuration error: unsupported 1th argument to "route" which looks like a FQDN but only IPv4 address supported (line XX)`
Looks like the `route` config option is not available in NM ovpn config but the alternative `route-data` can be used.
The syntax remains the same:
`route-data IP netmask gateway`
@Hritik14
Hritik14 / multi-net.sh
Created April 20, 2020 05:42
Multipath routing to increase bandwith
#!/bin/bash
# (C) Hritik Vijay
# License: GPLv2
Table=200
route_cmd="ip route add default scope global "
# Iterate through each interface and process them
while read -r line; do
P=$(echo $line | grep -Eo 'via [0-9\.]+ ' | cut -d " " -f 2)
@Hritik14
Hritik14 / mysteriousC.md
Last active May 7, 2020 11:16
char c = 4["ABCEDF"]
weird.c
--------------
#include<stdio.h>
int main(){
	int i = 4;
	char c = i["ABCDEF"];
	printf("%c", c);
	return 0;
}

Hi there. Welcome to my channel.
Here we will solve Rach's dilemma.
Ready ?

You may jump to Tl;dr

Consider this program:

#include<stdio.h>    
int main(){    
@Hritik14
Hritik14 / dec2bin.c
Created July 23, 2020 14:27
Convert decimal to binary using bitwise operations. [Supports showing the memory of floats as well]
#include<stdio.h>
#include<string.h>
/*
* bitwisei -- decimal to binary using bitwise operators
* masks n with 0001
* then with 0010
* then with 0100
* then with 100
* in order to find out if the corresponding bit is on in n
@Hritik14
Hritik14 / dec2bin_sprintf.c
Created July 23, 2020 14:31
decimal to binary, version B. Uses printf's "%x" modifier. Doesn't support floats.
#include<stdio.h>
#include<string.h>
#define HEX_SIZE 7
/*
* converts hex to bin
* bin MUST be able to accomodate hex_size*4 elements
*/
int hex2bin(char* bin, char* hex, size_t hex_size ){
int i;
@Hritik14
Hritik14 / deploy.sh
Last active October 13, 2020 11:56
Deploy go project to AWS lambda.
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
#CHANGE THIS
AWS_FUNCTION_NAME=routine
_green(){
echo -e "\033[32m$1\033[0m"
}
@Hritik14
Hritik14 / vim-kernel-development.md
Last active May 14, 2021 11:05
Use vim for kernel development
@Hritik14
Hritik14 / packinitcpio.sh
Created May 27, 2021 23:05
build_image function from mkinitcpio
#!/bin/bash
build_image() {
local out=$1 compress=$2 errmsg pipestatus
case $compress in
cat)
msg "Creating uncompressed initcpio image: %s" "$out"
unset COMPRESSION_OPTIONS
;;