Skip to content

Instantly share code, notes, and snippets.

View arkag's full-sized avatar

Alexander Kagno arkag

  • Denver, CO, USA
View GitHub Profile
server {
server_name sub.domain.com;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
set $!alarmmsg1 = "hello";
set $!alarmfile = "alarm";
if ($programname == "hello" and $msg contains $!alarmmsg1) then { set $!appmsg = "alarm"; }
else { set $!appmsg = "not-an-alarm"; }
template(name="%$!alarmfile%" type="string" string="{{ hub_log_mount }}/%$!env%/%$!alarmfile%.log")
if ( $!appmsg == "alarm" ) then
{
action(name="alarm" type="omfile" dynaFile="%$!alarmfile%" fileCreateMode="0644" dirCreateMode="0755" dynaFileCacheSize="100")
Compiling: users/arkag/arkag.c [OK]
Compiling: keyboards/mechmini/v2/keymaps/arkag/keymap.c [OK]
Linking: .build/mechmini_v2_arkag.elf [ERRORS]
|
| .build/obj_mechmini_v2_arkag/keyboards/mechmini/v2/keymaps/arkag/keymap.o (symbol from plugin): In function `keymaps':
| (.text+0x0): multiple definition of `tap_dance_actions'
| .build/obj_mechmini_v2_arkag/arkag.o (symbol from plugin):(.text+0x0): first defined here
| .build/obj_mechmini_v2_arkag/keyboards/mechmini/v2/keymaps/arkag/keymap.o (symbol from plugin): In function `keymaps':
| (.text+0x0): multiple definition of `state'
| .build/obj_mechmini_v2_arkag/arkag.o (symbol from plugin):(.text+0x0): first defined here
void check_state (void) {
static bool slept_once, woke_once;
switch (state) {
case active:
if (!woke_once){rgblight_mode_noeeprom(DEF_RGB_MODE); woke_once = true;}
active_timer_two = timer_read();
elapsed = active_timer_two - active_timer_one;
if (elapsed < INACTIVE_DELAY) {state = active; return;}
state = inactive;
return;
@arkag
arkag / flash_rgb.c
Last active September 11, 2018 19:51
void flash_rgb (void) {
switch(current_state) {
case always_on:
set_color(underglow, false);
return;
case flash_begin:
timer_one = timer_read();
current_state = flash_off;
void surround_type(uint8_t num_of_char, uint8_t keycode) {
char str[2*(num_of_char + (num_of_char / 2))];
for (int i = 0; i < num_of_char; i++) {
}
for (int i = 0; i < (num_of_char/2); i++) {
SEND_STRING(X_LEFT);
}
}
#define MOD_GUI_MASK (MOD_BIT(KC_LGUI) | MOD_BIT(KC_RGUI))
#define MOD_CTL_MASK (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL))
#define MOD_ALT_MASK (MOD_BIT(KC_LALT) | MOD_BIT(KC_RALT))
#define MOD_SFT_MASK (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case KC_ESC:
if (get_mods() & MOD_GUI_MASK) {
@arkag
arkag / fade.c
Last active September 11, 2018 22:09
void buffer_fade(Color current_color, Color new_color) {
uint16_t difference = new_color.h - current_color.h;
for (int i = 0; i <= difference; i++) {
fade_buffer++;
}
}
void fade_rgb (void) {
switch(fade_state){
case start:
Color mod_color(Color current_color, bool should_add, uint16_t change_amount) {
uint16_t addlim = 359 - change_amount;
uint16_t sublim = change_amount;
uint16_t leftovers;
if (should_add) {
if (current_color.h <= addlim) {
current_color.h += change_amount;
} else {
leftovers = (359 + change_amount) % 359;
current_color.h = 0 + leftovers;
void matrix_scan_user(void) {
if (flash && !flash_on_started && !flash_off_started) {
flash_start_timer = timer_read();
flash_on_started = true;
set_color(underglow, false);
} else if (flash && flash_on_started && !flash_off_started) {
uint16_t flash_timer = timer_read();
uint16_t elapsed = flash_timer - flash_start_timer;
if (elapsed >= LED_FLASH_DELAY) {
flash_on_started = false;