Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <BLEDevice.h> | |
#include <BLEServer.h> | |
#include <BLEUtils.h> | |
#include <BLE2902.h> | |
uint8_t note = 38; | |
int SNARE[6] = {150, 4000, 38, 3, 0, 0}; //{threshold, sensitivity, note(no use), flag, velocity, last peakValue} | |
boolean snareFlag = false; | |
BLECharacteristic *pCharacteristic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery alterClass plugin | |
* | |
* Remove element classes with wildcard matching. Optionally add classes: | |
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' ) | |
* | |
* Copyright (c) 2011 Pete Boere (the-echoplex.net) | |
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DUCKPATH=~/duckdns | |
TOKEN=changeme | |
DOMAINS=steelcomputers | |
curl -sSv "https://www.duckdns.org/update?domains=${DOMAINS}&token=${TOKEN}&ip=" \ | |
2>> ${DUCKPATH}/stderr.log \ | |
>> ${DUCKPATH}/stdout.log | |
printf ' - ' >> ${DUCKPATH}/stdout.log | |
date >> ${DUCKPATH}/stdout.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Single Responsibility Principle | |
“…You had one job” — Loki to Skurge in Thor: Ragnarok | |
A class should have only one job. | |
If a class has more than one responsibility, it becomes coupled. | |
A change to one responsibility results to modification of the other responsibility. | |
""" | |
class Animal: | |
def __init__(self, name: str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"unicode" | |
"golang.org/x/crypto/ssh/terminal" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------- | |
Setup Install HAProxy 1.8 on Ubuntu 16 | |
---------------------------------------- | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:vbernat/haproxy-1.8 | |
sudo apt-get update | |
apt-cache policy haproxy | |
sudo apt install haproxy | |
sudo update-rc.d haproxy enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http') | |
const crypto = require('crypto') | |
const server = http.createServer((req, res) => { | |
console.log('got request', req.url) | |
res.writeHead(200, { 'Content-Type': 'text/plain' }) | |
res.end('okay') | |
}) | |
server.on('upgrade', function (req, socket) { |
使用本指令碼即代表你同意本免責聲明。
本指令碼用於繞過臺灣電子書與教學工具的前端驗證,達成不需要教師帳號即可使用。
NewerOlder