Skip to content

Instantly share code, notes, and snippets.

@aharshac
aharshac / contracts...1_Storage.sol
Last active June 5, 2021 16:29
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.0+commit.acd334c9.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
@aharshac
aharshac / waveshare35a.txt
Created April 7, 2019 08:40
Waveshare screen config - Madhu N
1. use this /boot/cmdline.txt:
dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo
2. edit the end of /boot/config.txt to contain:
dtparam=audio=on
dtparam=spi=on
dtoverlay=ads7846,penirq=25,penirq_pull=2,xohms=150,swapxy=1,xmin=300,ymin=700,xmax=3800,ymax=3400,pmax=255
dtoverlay=waveshare35a
@aharshac
aharshac / start.gcode
Last active September 3, 2018 10:00
Julia 2018 Pro Dual - print with secondary nozzle
G21 ;metric values
G90 ;absolute positioning
M107 ;start with the fan off
G28 X0 Y0 ;move X/Y to min endstops
G28 Z0 ;move Z to min endstops
M420 S1 ;enabled bed leveling
T1 ;select hotend 1
G92 E0 ;reset extruder distance
G1 Z10 F300 ;move nozzle up 10mm for safe homing
@aharshac
aharshac / FW RPi Screen Rotation.md
Last active July 17, 2018 11:28
Commands for screen rotation

Normal Screen

  1. sudo sed -i -r 's/dtoverlay\s*=\s*waveshare35a(\s*:\s*rotate\s*=\s*([0-9]{1,3})){0,1}/dtoverlay=waveshare35a/g' /boot/config.txt
  2. sudo sed -i -r 's/Option\s+\"TransformationMatrix\"\s+\"(.+)\"/Option \"TransformationMatrix\" \"0 -1 1 1 0 0 0 0 1\"/g' /etc/X11/xorg.conf.d/99-calibration.conf
  3. sudo reboot now

 

Rotated Screen

  1. sudo sed -i -r 's/dtoverlay\s*=\s*waveshare35a(\s*:\s*rotate\s*=\s*([0-9]{1,3})){0,1}/dtoverlay=waveshare35a:rotate=270/g' /boot/config.txt
  2. sudo sed -i -r 's/Option\s+\"TransformationMatrix\"\s+\"(.+)\"/Option \"TransformationMatrix\" \"0 1 0 -1 0 1 0 0 1\"/g' /etc/X11/xorg.conf.d/99-calibration.conf
@aharshac
aharshac / CFM.md
Last active July 1, 2017 20:51
Collaborizm Flavoured Markdown

Collaborizm Flavoured Markdown (CFM) is an extension of GitHub Flavoured Markdown (GFM) Markdown-it is used on Collaborizm to parse Markdown to HTML.

CFM is the work of @Robert Lancer and @Anton Voltchok

This reference is posted in the best interest of new users. #hello

@Steven Reubenstone

 

@aharshac
aharshac / Fetch URL title - Node.js
Last active February 25, 2021 06:47
Node.js snippet to fetch URL title
var request = require('request');
var cheerio = require('cheerio');
function fetchTitle(url, onComplete = null) {
request(url, function (error, response, body) {
var output = url; // default to URL
if (!error && response.statusCode === 200) {
var $ = cheerio.load(body);
console.log(`URL = ${url}`);
@aharshac
aharshac / collaborizm-community-fix-1.css
Last active April 25, 2017 04:16
collaborizm-community-fix-1
table
{
background-color: #fff;
width: 100%;
max-width: 100%;
margin-top: 20px !important;
margin-bottom: 20px !important;
border-collapse: collapse;
}
@aharshac
aharshac / collaborizm-community-fix-1.min.css
Last active April 25, 2017 04:19
collaborizm-community-fix-1.min
table{background-color:#fff;width:100%;max-width:100%;margin-top:20px!important;margin-bottom:20px!important;border-collapse:collapse}table>thead>tr>th{line-height:1.4285714}table>tbody>tr>td,table>tbody>tr>th,table>tfoot>tr>td,table>tfoot>tr>th,table>thead>tr>td{line-height:1.4285714;vertical-align:top;text-align:left}table>thead>tr>th{vertical-align:bottom;font-weight:700}table>caption+thead>tr:first-child>td,table>caption+thead>tr:first-child>th,table>colgroup+thead>tr:first-child>td,table>colgroup+thead>tr:first-child>th,table>thead:first-child>tr:first-child>td,table>thead:first-child>tr:first-child>th{border-top:0}table>tbody+tbody{border-top:2px solid #ddd}table>tbody>tr>td,table>tbody>tr>th,table>tfoot>tr>td,table>tfoot>tr>th,table>thead>tr>td,table>thead>tr>th{padding:5px}table,table>tbody>tr>td,table>tbody>tr>th,table>tfoot>tr>td,table>tfoot>tr>th,table>thead>tr>td,table>thead>tr>th{border:1px solid #ddd}table>thead>tr>td,table>thead>tr>th{border-bottom-width:2px}table>tbody>tr:nth-child(odd)>td,tab
|Pin|To|Peripherals|Peripherals|To|Pin|
|--- |--- |--- |--- |--- |--- |
|1|-|3.3V|5V|-|2|
|3|-|SDA0|5V|Relay VCC (Headlight)|4|
|5|-|SCL0|GND|Relay GND (Headlight)|6|
|7|L298N D2 (LHS Fwd)|GPIO4|GPIO14/TXD0|-|8|
|9|L298N GND (0V)|GND|GPIO15/RXD0|-|10|
|11|L298N D1 (LHS Rev)|GPIO17|GPIO18/PWM0|Pan Servo SIG|12|
|13|L298N D4 (RHS Fwd)|GPIO27|GND|-|14|
|15|L298N D3 (RHS Rev)|GPIO22|GPIO23|Relay SIG (Headlight)|16|
@aharshac
aharshac / cizm-table.css
Last active April 5, 2017 19:32
Table CSS for Collaborizm
/*
Classes: cizm-table cizm-table-striped cizm-table-bordered cizm-table-hover cizm-table-condensed
cizm-table = main
cizm-table-striped = alternate coloured rows
cizm-table-bordered = table border
cizm-table-hover = interactive hover
cizm-table-condensed = lesser cell paddiing
*/