Skip to content

Instantly share code, notes, and snippets.

@malikshubham827
malikshubham827 / www
Created July 25, 2017 06:22
This is regarding get-me-through project. Include this file in the bin folder in the root of your project. You would have a bin folder if you created virtual environment. If not create a bin folder and paste this file with the name "www" no extension should be attached to it.
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../server/app');
var debug = require('debug')('my-app:server');
var http = require('http');
@chsasank
chsasank / ipynb_to_gallery.py
Last active December 9, 2025 22:39
Convert jupyter notebook to sphinx gallery notebook styled examples.
@ryanflorence
ryanflorence / Performance Conditionally Rendered Content in React.md
Last active December 30, 2023 18:12
Performance Conditionally Rendered Content in React

Performance and Conditionally Rendered Content in React

First, this is not about if in JSX. It's just the simplest example to talk about (and a lot of people tried to do it at first a long time ago).

Some react components conditionally render content. When React first went public, a lot of us coming from handlebars really wanted "if" syntax. This gist isn't just about If components though, it's about

// Touch screen library with X Y and Z (pressure) readings as well
// as oversampling to avoid 'bouncing'
// This demo code returns raw readings, public domain
#include <stdint.h>
#include "TouchScreen.h"
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#include <stdio.h>
#include <Wire.h> // I2C library for I2C LCD
#define USEI2CLCD // 不使用就在前面加 //
#ifdef USEI2CLCD
#define ADDRI2CLCD 0x3C
#endif
#define _SCK 5
#define _CS 2
#define _SO 8
static volatile uint8_t is_tc_open;
@knoxcu
knoxcu / StandardFirmataForATH0.ino
Created May 25, 2016 14:11 — forked from edgarsilva/StandardFirmataForATH0.ino
Modified firmata protocol that works on the arduino YUN linux side communicating to the arduino side using the ttyATH0 serialport interface.
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please clink on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/
@sleemanj
sleemanj / max6675.ino
Created May 18, 2016 07:43
MAX6675 Thermocouple Reader Example Arduino Code
/** MAX6675 Thermocouple Reader Example Code
*
* This is so simple a library would be silly!
*
* 6675 Module ==> Arduino
* CS ==> D10
* SO ==> D12
* SCK ==> D13
* Vcc ==> Vcc (5v OK)
* Gnd ==> Gnd
@gbaman
gbaman / HowToOTG.md
Last active January 21, 2026 00:59
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@mikberg
mikberg / connection.js
Last active December 29, 2021 16:57
MongoDB connection with async/await
import { MongoClient } from 'mongodb';
import promisify from 'es6-promisify';
let _connection;
const connect = () => {
if (!process.env.MONGO_CONNECTION_STRING) {
throw new Error(`Environment variable MONGO_CONNECTION_STRING must be set to use API.`);
}
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active March 4, 2026 00:52
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents