Skip to content

Instantly share code, notes, and snippets.

@NSBum
NSBum / df
Created Mar 11, 2020
External note editor error log
View df
Syncing failed:
Traceback (most recent call last):
File "aqt/sync.py", line 376, in _sync
File "aqt/sync.py", line 356, in _abortingSync
File "anki/sync.py", line 44, in sync
File "anki/sync.py", line 592, in meta
File "anki/sync.py", line 556, in req
File "anki/sync.py", line 441, in post
File "requests/sessions.py", line 572, in post
File "requests/sessions.py", line 510, in request
View foldergallery.html
<!-- /layouts/shortcodes/foldergallery.html -->
<style>
div.gallery {
display: flex;
flex-wrap: wrap;
}
div.gallery a {
flex-grow: 1;
@NSBum
NSBum / 4bit7segment.ino
Created Apr 16, 2018
4 bits 7 segment with shift registers
View 4bit7segment.ino
unsigned char LED_0F[] =
{// 0 1 2 3 4 5 6 7 8 9 A b C d E F -
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x8C,0xBF,0xC6,0xA1,0x86,0xFF,0xbf
};
unsigned char LED[4]; //用于LED的4位显示缓存
int SCLK = 2;
int RCLK = 1;
int DIO = 0; //这里定义了那三个脚
void setup ()
{
@NSBum
NSBum / RF24_Button_Relay_test.cpp
Created Mar 29, 2018
Trigger relay remotely using nRF24L01+ modules
View RF24_Button_Relay_test.cpp
#include <SPI.h>
#include "RF24.h"
#include <EEPROM.h>
/* Hardware connections from Arduino Nano to nRF24L01
* CE -> D9
* CSN -> D10
* SCK -> D13
* MOSI -> D11
* MISO -> D12
@NSBum
NSBum / si7021.c
Last active Apr 27, 2018
Example of reading from Si7021 with Raspberry Pi
View si7021.c
#include <stdio.h>
#include <stdlib.h>
#include <bcm2835.h>
#include <string.h>
/*+---------------------------------------------------------+
| |
| si7021.c - Read Si7021 temperature and humidity |
| over I2C bus using Raspberry Pi |
@NSBum
NSBum / mcp3008.c
Created Mar 3, 2018
Reading MCP3008 using C on the Raspberry Pi
View mcp3008.c
// Using C to read the MCP3008 10-bit
// ADC via SPI
#include <stdio.h>
#include <bcm2835.h>
uint8_t start = 0x01;
uint8_t end = 0x00;
uint8_t chan = 0x00;
@NSBum
NSBum / rpi-bcm2835-lib-install.sh
Created Mar 3, 2018
Version-agnostic installation of Raspberry Pi BCM2835 library for C
View rpi-bcm2835-lib-install.sh
sudo apt-get install html-xml-utils
mkdir -p bcm2835 && (wget -qO - `curl -sL http://www.airspayce.com/mikem/bcm2835 | hxnormalize -x -e | hxselect -s '\n' -c "div.textblock>p:nth-child(4)>a:nth-child(1)"` | tar xz --strip-components=1 -C bcm2835 )
cd bcm2835
./configure
make
sudo make install
@NSBum
NSBum / FadeTrack.scpt
Created Jan 11, 2018
Play and fade the current iTunes track
View FadeTrack.scpt
--
-- Created by: Alan Duncan
-- Created on: 2018-01-11
--
-- Copyright (c) 2018 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
@NSBum
NSBum / ru_audio_wiktionary.py
Created Nov 3, 2017
Download Russian pronunciation from Wiktionary
View ru_audio_wiktionary.py
#!/usr/bin/python
# encoding=utf8
import re
import requests
import urllib2
import xerox
from os.path import expanduser, normpath, basename, join
import Foundation
import objc
@NSBum
NSBum / Decookify Safari.scpt
Created Mar 29, 2017
Remove cookies from Safari
View Decookify Safari.scpt
--
-- Created by: Alan Duncan
-- Created on: 2017-03-29
--
-- Copyright (c) 2017 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
You can’t perform that action at this time.