Skip to content

Instantly share code, notes, and snippets.

View Miraj50's full-sized avatar

Rishabh Raj Miraj50

View GitHub Profile
@Miraj50
Miraj50 / main.js
Last active February 22, 2024 15:11
Minimal Electron App with Python backend
const {app, BrowserWindow} = require('electron')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
@Miraj50
Miraj50 / Master_script.sh
Last active April 14, 2018 16:51
Control one C program from another C program
#!/bin/sh
g++ ex1.c -o simp
g++ ex.c
./a.out & # Run the two C programs simultaneously
./simp
A=$? # Store return status of ex1.c
PID=$! # Store Process ID of the program going on
@Miraj50
Miraj50 / replace_line_in_file.c
Last active April 10, 2018 16:53
Replace a line in file containing a particular string in C
#include <stdio.h>
#include <bits/stdc++.h>
#include <string.h>
int main(){
int x = 2, y = 2, dir = 6, tok = 0, nxtsig = 5;
// Don't get confused by the variable names. The data file is in this format -> x,y,dir,tok,nxtsig
char init[100];
snprintf(init, sizeof(init), "%d\\,%d\\,%d.*", x, y, dir);
char newda[100];