Skip to content

Instantly share code, notes, and snippets.

View sm00th's full-sized avatar

Artem Savkov sm00th

  • Red Hat
  • Brno, CZ
View GitHub Profile
@sm00th
sm00th / ballTracking.cpp
Created December 15, 2011 17:17
OpenCV code for arduino balltracking project http://youtu.be/G2nHMlx8npQ
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
using namespace std;
using namespace cv;
@sm00th
sm00th / gist:1709496
Created January 31, 2012 08:42
UTF8 version of il.pl irssi script.
#
# for all who dont like perl:
# inputlength = "{sb length: $@L}";
#
# with leading spaces: (3 spaces in example)
# inputlength = "{sb $[-!3]@L}";
#
# with leading char "-"
#
# inputlength = "{sb $[-!3-]@L}";
#include <Servo.h>
#define MIN_Y 90
#define MAX_Y 180
#define MIN_X 0
#define MAX_X 180
Servo tilt;
Servo pan;
@sm00th
sm00th / aes.c
Created September 19, 2013 12:24
w2 aes stuff
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/aes.h>
uint8_t cbc_key[] = {0x14, 0x0b, 0x41, 0xb2, 0x2a, 0x29, 0xbe, 0xb4, 0x06, 0x1b, 0xda, 0x66, 0xb6, 0x74, 0x7e, 0x14};
uint8_t cbc_msg1[] = {0x4c, 0xa0, 0x0f, 0xf4, 0xc8, 0x98, 0xd6, 0x1e, 0x1e, 0xdb, 0xf1, 0x80, 0x06, 0x18, 0xfb, 0x28, 0x28, 0xa2, 0x26, 0xd1, 0x60, 0xda, 0xd0, 0x78, 0x83, 0xd0, 0x4e, 0x00, 0x8a, 0x78, 0x97, 0xee, 0x2e, 0x4b, 0x74, 0x65, 0xd5, 0x29, 0x0d, 0x0c, 0x0e, 0x6c, 0x68, 0x22, 0x23, 0x6e, 0x1d, 0xaa, 0xfb, 0x94, 0xff, 0xe0, 0xc5, 0xda, 0x05, 0xd9, 0x47, 0x6b, 0xe0, 0x28, 0xad, 0x7c, 0x1d, 0x81};
uint8_t cbc_msg2[] = {0x5b, 0x68, 0x62, 0x9f, 0xeb, 0x86, 0x06, 0xf9, 0xa6, 0x66, 0x76, 0x70, 0xb7, 0x5b, 0x38, 0xa5, 0xb4, 0x83, 0x2d, 0x0f, 0x26, 0xe1, 0xab, 0x7d, 0xa3, 0x32, 0x49, 0xde, 0x7d, 0x4a, 0xfc, 0x48, 0xe7, 0x13, 0xac, 0x64, 0x6a, 0xce, 0x36, 0xe8, 0x72, 0xad, 0x5f, 0xb8, 0xa5, 0x12, 0x42, 0x8a, 0x6e, 0x21, 0x36, 0x4b, 0x0c, 0x37, 0x4d, 0xf4, 0x55, 0x03, 0x47, 0x3c, 0x52, 0x42,
@sm00th
sm00th / vfhash.c
Created September 25, 2013 14:51
w3 sha256 stuff
#include <stdio.h>
#include <stdint.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <openssl/evp.h>
@sm00th
sm00th / cc_slave.pde
Created May 14, 2015 06:33
Classic Wii Controller Emulation with Arduino
#include <Wire.h>
#include "wm_crypto.h"
#define TWI_FREQ 400000L
#define EC_ADDR 0x52
#define PACKET_SIZE 6
#define REC_EV 0x01
#define REQ_EV 0x02
@sm00th
sm00th / selfnames.patch
Created January 2, 2016 11:48
bitlbee-discord patch enabling selfmessages while failing to distinguish between messages sent from other sources and self.
diff --git a/src/discord-handlers.c b/src/discord-handlers.c
index d76ff65..07fa0b0 100644
--- a/src/discord-handlers.c
+++ b/src/discord-handlers.c
@@ -302,12 +302,18 @@ static void discord_handle_server(struct im_connection *ic, json_value *sinfo,
}
static void discord_post_message(channel_info *cinfo, const gchar *author,
- gchar *msg)
+ gchar *msg, gboolean is_self)
@sm00th
sm00th / mfa_debug.patch
Created July 31, 2016 21:58
bitlbee-discord: add mfa debug info
diff --git a/src/discord-http.c b/src/discord-http.c
index 92c2d5f..48d843d 100644
--- a/src/discord-http.c
+++ b/src/discord-http.c
@@ -120,6 +120,7 @@ static void discord_http_mfa_cb(struct http_request *req)
{
struct im_connection *ic = req->data;
+ g_print("%s: %s\n", __func__, req->reply_body);
json_value *js = json_parse(req->reply_body, req->body_size);
@sm00th
sm00th / better_friendship.diff
Created September 23, 2017 17:07
proposed friendship changes
diff --git a/src/discord-handlers.c b/src/discord-handlers.c
index b38f807..72b9571 100644
--- a/src/discord-handlers.c
+++ b/src/discord-handlers.c
@@ -84,7 +84,6 @@ static void discord_handle_presence(struct im_connection *ic,
}
const char *status = json_o_str(pinfo, "status");
- int flags = 0;
#include <stdio.h>
#include <glib.h>
static char *imc_away_alias_list[8][5] =
{
{ "Away from computer", "Away", "Extended away", NULL },
{ "NA", "N/A", "Not available", NULL },
{ "Busy", "Do not disturb", "DND", "Occupied", NULL },
{ "Be right back", "BRB", NULL },
{ "On the phone", "Phone", "On phone", NULL },