Skip to content

Instantly share code, notes, and snippets.

@neutronstriker
neutronstriker / serialport.c
Created December 4, 2014 19:18
SerialPortWin
#include <windows.h>
#include <stdio.h>
int main()
{
//windows type variables
HANDLE hCom; //Handle variable
DWORD rwlen; // read/write length
char send[32];
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
//this program works correctly but please remember to open the serial port as super user or change the permission
//of the port for normal by the following command "sudo chmod 666 /dev/ttyUSB*" the * in here represents the port number
//this command has to be called every time we plug the device in, because everytime the device is plugged in a new file
#define SIPO PORTB
#define STB PB3
#define SPIN PB4
#define CLK PB5
//Rememeber DDRB |= (1<<STB) | (1<<SPIN) | (1<<CLK); //must be done in main() so as set these pins as output.
void send_nibble(unsigned char x) //try to make this also inline if necessary
{
#define F_CPU 1000000UL
#include<avr/io.h>
#include<util/delay.h>
#define SIPO_PORT B
#define SPIN 3 //PB3
#define STB 4 //PB4
#define CLK 5 //PB5
#define F_CPU 8000000UL //8Mhz internal RC oscillator for Tiny45
/*
Program Name: Powerbank_TINY
Author : NeutroN StrikeR aka N.Srinivas
Date : 01-09-2014
Email id:striker.dbz[at]hotmail.com
The software is provided with The MIT License (MIT)
Copyright (c) 2014 N.Srinivas
Permission is hereby granted, free of charge, to any person obtaining a copy
@neutronstriker
neutronstriker / write_errorlog_with_time_stamp.py
Created March 15, 2018 19:12
write prints to console and log
import time
errorLogFileName = 'logfile.log'
ferrlog = open(errorLogFileName,'w')
def write2ErrorLog(inputval):
data = str(inputval)
timeStamp = time.strftime('%Y-%m-%d,%H:%M:%S')
if data[0] == '\n':
print '\n'+timeStamp+' : '+data[1:]+'\n'
@neutronstriker
neutronstriker / openwrt-on-proxmox.md
Created May 26, 2024 18:28 — forked from subrezon/openwrt-on-proxmox.md
How to set up an OpenWRT VM in Proxmox
  1. Go to OpenWRT release page, select the latest release stable release, then targets -> x86 -> 64. Right-click generic-ext4-combined.img.gz (not the "efi"!) and copy the link.

  2. On the Proxmox host, download the archive and unpack it:

wget *paste link here*
gunzip openwrt-*.img.gz
  1. Resize the image to be the size you want your VM's disk to be (example with 8 GiB):