Skip to content

Instantly share code, notes, and snippets.

View samyk's full-sized avatar

samy kamkar samyk

View GitHub Profile

Keybase proof

I hereby claim:

  • I am samyk on github.
  • I am samy (https://keybase.io/samy) on keybase.
  • I have a public key whose fingerprint is 8EFB B6A5 6900 7401 B68F 9038 F4E1 C226 C2F6 EA94

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samyk
samyk / chrome_tabs.osa
Created June 14, 2016 18:36
applescript to show all url+titles of Chrome tabs along with front window+tab url+title
# shows all url+titles of Chrome along with front window+tab url+title
set titleString to ""
tell application "Google Chrome"
set window_list to every window # get the windows
repeat with the_window in window_list # for every window
set tab_list to every tab in the_window # get the tabs
repeat with the_tab in tab_list # for every tab
@samyk
samyk / sin134.c
Last active August 21, 2019 10:48
134kHz sine wave on Teensy 3.6
// We can send 223 analog values (per wavelength) with an unrolled loop to get ~134kHz sine wave on 180MHz Teensy 3.6
//
// A version that uses virtually no CPU by controlling the DAC via DMA and PDB is here:
// https://gist.github.com/samyk/6273cf9a45d63a50c38c8b50a39a8f52
//
// -samy kamkar
// If you want to use a for loop, you can only send 161vals per wavelength
/*
#define SINE 161
@samyk
samyk / package-vers.pl
Created December 30, 2016 07:55
print version numbers for all perl packages
# add to top of perl program to print version numbers for perl packages
use Data::Dumper;
print "$_\n" for grep { /:: \d/ } map { "$_ " . eval "\$${_}VERSION" } grep { /::$/ } keys %{"main::"};
@samyk
samyk / sin134-pdb-dma-dac.c
Last active September 8, 2020 19:17
134kHz sine wave w/DMA, DAC and PDB on Teensy 3.6
// Generating a 134kHz sine wave using Teensy 3.6 with virtually
// 0 cpu usage by filling the DAC up via DMA triggered by PDB
// -samy kamkar
#include <DMAChannel.h>
#include "pdb.h"
DMAChannel dma(false);
static volatile uint16_t sinetable[] = {
@samyk
samyk / sctag
Created November 23, 2018 21:09
Convert Supercell gamer tags / avatar IDs / account IDs between each other
#!/usr/bin/perl
#
# Convert Supercell gamer tags to avatar/account IDs and vice versa
# Tested on Crash Royale and Boom Beach
# - supports new Boom Beach avatar_id format
#
# -samy kamkar - https://samy.pl
# 2018/11/23
my @tagchrs = qw/0 2 8 9 P Y L Q G R J C U V/;
@samyk
samyk / syphon2serial.pde
Created June 29, 2019 19:00
Syphon to Serial Processing 2 app
/*
* syphon2serial (syphon -> teensy using octows2811)
* take video input from Syphon (eg Resolume Arena) out to Teensys over serial
* by Samy Kamkar - http://samy.pl - code@samy.pl
*
* based off of OctoWS2811 movie2serial
*/
/* OctoWS2811 movie2serial.pde - Transmit video data to 1 or more
Teensy 3.0 boards running OctoWS2811 VideoDisplay.ino
@samyk
samyk / mks_901p.py
Created December 29, 2019 19:19 — forked from nmz787/mks_901p.py
work in progress MKS 901P vacuum transducer sensor library and command-line program.
"""
usage: mks_901p.py [-h] [--find_baud] [--baud BAUD] [-unit] serial_port
positional arguments:
serial_port the Windows COM port or path to a linux serial port
optional arguments:
-h, --help show this help message and exit
--find_baud tries to access the sensor over all supported baud rates,
prints which is successful
@samyk
samyk / graph.html
Created November 17, 2022 05:33 — forked from kevinfjbecker/graph.html
HTML5 Canvas Line Graph
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Roulette</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,