Skip to content

Instantly share code, notes, and snippets.

View Robokishan's full-sized avatar

Kishan Joshi Robokishan

View GitHub Profile
@Robokishan
Robokishan / Run.py
Created April 17, 2023 05:36
Bypass employee timer software
# from pynput.keyboard import Key, Controller
import time
import random
import sys
import pyautogui
from datetime import datetime
# keyboard = Controller()
start = 20
end = 59
@Robokishan
Robokishan / diff.ts
Created March 11, 2022 05:20
diff json
export const getDeletedItems = (
primarykey: string,
oldValues: Array<any>,
newValues: Array<any>
): Array<any> => {
return oldValues.filter((old) => {
return !newValues.some((newValue) => {
return newValue[primarykey] === old[primarykey];
});
});
@Robokishan
Robokishan / multiple_ssh_setting.md
Last active November 19, 2021 07:07
Multiple github and bitbucket accounts on same computer

Multiple SSH Keys settings for different github and bitbucket account

create different public key | use same method for bitbucket but hostname and host will change

Create ~/.ssh/github folder

ssh-keygen -t rsa -b 4096 -C 'your-first-email@email.com' -f ~/.ssh/github/personal -q -N ''

@Robokishan
Robokishan / portainer_run.sh
Created November 18, 2021 06:17
portainer
docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
@Robokishan
Robokishan / timezone.js
Last active August 26, 2021 09:08
Just a time zone hack
let date = new Date();
let offset = 19800;
console.log(parseInt(date.getTime() / 1000));
console.log(date.getTimezoneOffset());
console.log(date.toISOString());
let _offset = 28800 * 1000
console.log(_offset);
date.setTime( date.getTime() - (offset * 1000) + _offset );
console.log(date.toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: true }), _offset,date.getTimezoneOffset(), date.getTimezoneOffset() * 60 * 1000);
@Robokishan
Robokishan / bulk_python_request.py
Created May 19, 2021 10:00
python example for sending bulk request to server
import json
import os
import requests
import threading
import time
class Manager:
server = os.getenv('GATEWAY_URL', "http://p1007.local:8080")
@Robokishan
Robokishan / expand-pi-image.sh
Last active November 23, 2021 23:16
Expand pi image
#sudo bash expand-pi-image.sh <img-file>
#sudo setup-chroot.sh <img-file>
#run changes and type exit
if [ "$1" ]; then
real_file_path=`realpath "${1}"`
echo "Img File: ${real_file_path}"
dd if=/dev/zero bs=1M count=1024 >> $real_file_path
sudo kpartx -v -a $real_file_path
loop_device=`losetup --list | grep "${real_file_path}" | cut -d ' ' -f1 | cut -d'/' -f3`
echo "Loop Device => /dev/${loop_device}"
@Robokishan
Robokishan / setup-chroot.sh
Created February 17, 2021 05:26
This is script shortcut for chroot-to-pi.sh
if [ "$1" ]; then
sudo kpartx -v -a $1
loop_device=`losetup --list | grep "2021-02-02-raspbian-lite.img" | cut -d ' ' -f1 | cut -d'/' -f3`
mapper_loop_device="/dev/mapper/${loop_device}p"
echo "Mapper device => ${mapper_loop_device}"
echo "Mounting to => `ls /mnt`"
sudo bash chroot-to-pi.sh $mapper_loop_device
sudo kpartx -d $1
else
echo "Please Provide img file"
@Robokishan
Robokishan / chroot-to-pi.sh
Created February 5, 2021 07:16 — forked from htruong/chroot-to-pi.sh
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@Robokishan
Robokishan / raspberry-pi-chroot-armv7-qemu.md
Created February 5, 2021 07:15 — forked from htruong/raspberry-pi-chroot-armv7-qemu.md
Chroot into Raspberry Pi ARMv7 Image with Qemu
# raspbian stretch lite on ubuntu

### You can write the raspbian image onto the sd card,
# boot the pi so it expands the fs, then plug back to your laptop/desktop
# and chroot to it with my script 
# https://gist.github.com/htruong/7df502fb60268eeee5bca21ef3e436eb
# sudo ./chroot-to-pi.sh /dev/sdb
# I found it to be much less of a pain in the ass and more reliable
# than doing the kpartx thing