Skip to content

Instantly share code, notes, and snippets.

View gopalkildoliya's full-sized avatar
🎯
Focusing

Gopal gopalkildoliya

🎯
Focusing
View GitHub Profile
@gopalkildoliya
gopalkildoliya / index.js
Last active June 24, 2020 04:06
Firebase function to handle Paddle incoming events
const crypto = require('crypto');
const Serialize = require('php-serialize');
const functions = require('firebase-functions');
const admin = require('firebase-admin')
admin.initializeApp();
const pubKey = `-----BEGIN PUBLIC KEY-----
YOUR PUBLIC KEY HERE
@gopalkildoliya
gopalkildoliya / Account.vue
Created October 21, 2019 10:51
VueJs Component for Paddle
<template>
<div>
<div class="content has-text-centered" v-if="user">
<button @click="subscribe">Checkout</button>
</div>
</div>
</template>
<script
import {db, firebase} from "../db";
<script src="https://cdn.paddle.com/paddle/paddle.js"></script>
<script type="text/javascript">
Paddle.Setup({ vendor: 1234567 });
</script>
@gopalkildoliya
gopalkildoliya / shrink_sd_image.md
Created March 7, 2019 12:44
Shrink SD card image

Copy SD Card image

First we will create a .img file of your SD card image.

Linux users can just use dd (the same command you probably used to get the image onto the SD card in the first place) or the dcfldd command (which shows the progress of the operation unlike dd). For example, to copy all contents off the device that represents your SD card into an .img file in your home directory:

You should find out the block size of your sd card first (using an improper block size can lead to issues later on... TRUST)

$ sudo fdisk -l /dev/mmcblk0
@gopalkildoliya
gopalkildoliya / conf8.json
Created February 27, 2018 12:12
SwarmSense IoT with Mongoose OS
{
"mqtt":{
"server": "<swarmsense_server>",
"user": "sensor_<sensor_id>",
"pass": "<sensor_key>"
},
"wifi":{
"sta": {
"ssid": "ssid",
"pass": "password"

File System vs Database to Save Files

File System

Pros

  • Performance can be batter then DB in case of large files.
  • Saving and downloading is easy.
  • Migration of data is easy. Just copy the folder and paste it on destination.
@gopalkildoliya
gopalkildoliya / watchdog.md
Created September 5, 2016 11:22 — forked from Spindel/watchdog.md
Showing off the systemd watchdog in Python

Watchdogged

Place the service file (or a link to it) in /etc/systemd/system/ Place the watchdogged.py file somewhere ( and change the ExecStart portion in the .service to point at the file )

then do systemctl daemon-reload followed by systemctl start watchdogged.service

After this you can watch the progress using journalctl --follow -u watchdogged.service change the PROBABILITY variable to something else to watch it faster/later or succeed.