Skip to content

Instantly share code, notes, and snippets.

@danielkwood
danielkwood / l293d_motor_code_with_ultrasonic.ino
Created February 28, 2023 03:13
L293D motor code with ultrasonic sensor
// First, download and unzip the Adafruit-Motor-Shield-library-master library from https://github.com/adafruit/Adafruit-Motor-Shield-library
// Extract the ZIP file and copy the folder into the Arduino/libraries directory (inside your Documents folder)
#include <AFMotor.h>
#define echoPin 9 // attach pin D9 on Arduino (SER1 on motor shield)) to ECHO pin on ultrasonic sensor
#define trigPin 10 // attach pin D10 on Arduino (SERVO_2 on motor shield) to TRIG pin on ultrasonic sensor
long duration; // duration of sound wave travel
int distance; // distance measured

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@Misaka-0x447f
Misaka-0x447f / useHybridState.ts
Last active May 9, 2024 15:03
useHybridState.ts
import { isFunction, isObjectLike } from 'lodash-es'
import { useCallback, useRef, useState, useMemo, Dispatch, SetStateAction } from 'react'
/**
* @author 447f@misaka.com
* this hook allows reading an updated state value
* immediately by an extra ref.
* write to this ref is **not allowed** and should
* trigger an error.
* @example
@rxaviers
rxaviers / gist:7360908
Last active May 9, 2024 15:03
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 15:00
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@cvan
cvan / google_fonts.md
Created March 12, 2016 00:12
get ttf, woff, woff2 from Google Fonts

ttf

curl 'https://fonts.googleapis.com/css?family=Karla'

woff2

curl 'https://fonts.googleapis.com/css?family=Karla' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'User-Agent: AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116'

woff

@thomasdarimont
thomasdarimont / docker-compose.yml
Created January 25, 2019 17:52
Docker OpenLDAP + phpldapadmin example
version: '2'
services:
openldap:
image: osixia/openldap:1.2.3
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "Example Inc."
LDAP_DOMAIN: "example.org"
LDAP_BASE_DN: ""
@jb0gie
jb0gie / flutter.md
Created February 23, 2019 00:27 — forked from matteocrippa/flutter.md
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@ScottMaclure
ScottMaclure / slack_draft_deleter.js
Last active May 9, 2024 14:58
Slack Draft Deleter
// Remove all drafts from your drafts view
// Navigate to drafts
// F12 to raise dev console
// Paste the below
(async function(x) {
for (let e = document.querySelector('[type="trash"]'); e != null; e = document.querySelector('[type="trash"]')) {
e.click();
await new Promise(resolve => setTimeout(resolve, 500))
document.querySelector('[data-qa="drafts_page_draft_delete_confirm"]').click();
await new Promise(resolve => setTimeout(resolve, 1500))
@dylan-evans
dylan-evans / tree.sql
Created March 25, 2011 15:33
An sqlite3 demonstration of hierarchical data
-- A method for storing and retrieving hierarchical data in sqlite3
-- by using a trigger and a temporary table.
-- I needed this but had trouble finding information on it.
-- This is for sqlite3, it mostly won't work on anything else, however
-- most databases have better ways to do this anyway.
PRAGMA recursive_triggers = TRUE; -- This is not possible before 3.6.18
-- When creating the Node table either use a primary key or some other