Skip to content

Instantly share code, notes, and snippets.

View alexymik's full-sized avatar
🏠
Working from home

Alexy Mikhailichenko alexymik

🏠
Working from home
View GitHub Profile
@alexymik
alexymik / Bitcoin.ticker.php
Last active August 29, 2015 13:56
Executes a CURL request to bitcoin ticker APIs, gets the JSON reply, formats it as an output string
<?PHP
//Executes a CURL request to bitcoin ticket APIs, gets the JSON reply
//Todo: API JSON error detection, more sites
$bitcoin_sites = array(
array(
'name' => 'Mt.Gox [Dead]',
'coins' => array(
array(
@alexymik
alexymik / Keygen.c
Last active August 29, 2015 13:57
Keygen for a certain program
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char** argv) {
//Todo: extract registry value automatically, more validation
//Date lives here:
//HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\SystemBiosDate
@alexymik
alexymik / XR2.control.py
Last active August 29, 2015 13:57
Python code to control XR-2 Robotic Arm over a serial port using keyboard
#!/usr/bin/python
#Todo: smoother control, need to find optimal rate of movement
import serial
import math
import time
import curses
#User constants
ROBOT_STEP_AMOUNT = 25;
@alexymik
alexymik / XR2.control.m
Created March 11, 2014 23:28
Matlab code to control XR-2 Robotic Arm with an Xbox 360 controller
% Values you will most likely want to change:
ROBOT_STEPS = 20;
COM_PORT = 'COM9';
POLL_RATE = 0.1;
% Set up joystick
disp('Connecting to Xbox Controller... ');
XBOX_CONTROLLER = vrjoystick(1);
disp(caps(XBOX_CONTROLLER));
%disp(INSTRFIND);
@alexymik
alexymik / NeoPixel.Matrix.Wipes.ino
Last active April 12, 2023 02:56
Cycles through animations of random colors on my NeoPixel board. Uses the Adafruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#define PIN 4
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
@alexymik
alexymik / Impulse.Generator.ino
Last active August 29, 2015 13:57
Experiment to see if various low cost ATMega processors on Arduinos were fast enough to trigger some scientific equipment. Next step would be ASM. Measured with an oscilloscope
const int TRIGGER_PIN = 8;
const double HIGH_TIME = .012;
const int LOW_TIME = 10;
const int PULSE_DELAY = 98;
const int GROUP_DELAY = 920;
void setup() {
TRIGGER_PINMode(TRIGGER_PIN, OUTPUT);
}
@alexymik
alexymik / fizz_buzz.js
Created June 25, 2015 22:26
JavaScript FizzBuzz
var fizz_buzz = function(count) {
for (var i = 1; i <= count; i++) {
var output = i;
var fizz = false;
if (i % 3 == 0) {
output = 'Fizz';
fizz = true;
}
@alexymik
alexymik / chaining.js
Created June 27, 2015 00:10
JavaScript Chaining
function add(num1, num2) {
chain = function(num2) { return num1 + num2 };
if (num2) {
return chain(num2)
} else {
return chain
}
};
/*
Gur qrpvzny mvc bs gjb aba-artngvir vagrtref N naq O vf na vagrtre P jubfr
qrpvzny ercerfragngvba vf perngrq sebz gur qrpvzny ercerfragngvbaf
bs N naq O nf sbyybjf:
• gur svefg (v.r. gur zbfg fvtavsvpnag) qvtvg bs P vf gur svefg qvtvg bs N;
• gur frpbaq qvtvg bs P vf gur svefg qvtvg bs O;
• gur guveq qvtvg bs P vf gur frpbaq qvtvg bs N;
• gur sbhegu qvtvg bs P vf gur frpbaq qvtvg bs O;
• rgp.
Vs bar bs gur vagrtref N naq O ehaf bhg bs qvtvgf, gur erznvavat qvtvgf bs
@alexymik
alexymik / agnoster.zsh-theme.patch
Last active August 27, 2016 21:01
Agnoster theme tweaks
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 103041e..079ed90 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -164,7 +164,7 @@ prompt_hg() {
# Dir: current working directory
prompt_dir() {
- prompt_segment blue black '%~'
+ prompt_segment blue white '%~'