Skip to content

Instantly share code, notes, and snippets.

View anandijain's full-sized avatar
😎

anand jain anandijain

😎
View GitHub Profile
#include <stdio.h>
#include <stdint.h>
// Philips Sonicare NFC Head Password calculation by @atc1441 Video manual: https://www.youtube.com/watch?v=EPytrn8i8sc
uint16_t CRC16(uint16_t crc, uint8_t *buffer, int len) // Default CRC16 Algo
{
while(len--)
{
crc ^= *buffer++ << 8;
int bits = 0;
do
@ashwani-rathee
ashwani-rathee / serial-access.jl
Created January 14, 2023 06:31
Arduino UNO with Julia project
using LibSerialPort
using Distributed
using ArgParse
portname = "/dev/ttyUSB0"
baudrate = 9600
struct CustomType
val::Int
end
@Dan-Q
Dan-Q / _no_code_page_.php
Last active May 3, 2024 08:46
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@ashwani-rathee
ashwani-rathee / handgesturerecogniser.jl
Last active January 7, 2023 01:41
hand landmarks and gesture recognition in julia
### A Pluto.jl notebook ###
# v0.17.3
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
@zhuowei
zhuowei / Ensemble.plist
Last active September 18, 2023 06:26
Put this file as /Library/Preferences/FeatureFlags/Domain/Ensemble.plist and reboot to (hopefully) turn on Universal Control on macOS 12
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- not sure which one it is, so set both -->
<key>Ensemble</key>
<dict>
<key>Enabled</key>
<true/>
</dict>
@sdwfrost
sdwfrost / sine_esn.jmd
Last active May 19, 2021 18:26
Fitting a sine curve using an echo state network in ReservoirComputing.jl
# Sine regression using echo state networks in ReservoirComputing.jl
## Loading libraries
```julia
using Random
using Distributions
using Plots
using StatsPlots
using ParameterizedFunctions
#!/usr/bin/env bash
OS=$(uname)
ARCH="$(uname -m)"
get_julia_url() {
local VERSION=${1}
local MAJMIN="${VERSION%.*}"
if [[ "$OS" == "Linux" ]]; then
if [[ "$ARCH" == "x86_64" ]]; then
using IntervalArithmetic
using IntervalConstraintProgramming
using ModelingToolkit # currently (15 Feb 2021) requires version 3 of ModelingToolkit
using AbstractPlotting
using Colors
using WGLMakie
@TheCedarPrince
TheCedarPrince / init.vim
Last active November 17, 2022 09:28
My (neo)Vim Configuration File
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM SETTINGS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" TURNS LINE NUMBERING ON
set nu
" TRIGGER `autoread` WHEN FILES CHANGES ON DISK
set autoread
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
@elihugarret
elihugarret / plot_audio_input.jl
Last active October 9, 2020 16:37
Simple Pluto.jl notebook that plots audio input.
### A Pluto.jl notebook ###
# v0.11.8
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))