Skip to content

Instantly share code, notes, and snippets.

@hosaka
hosaka / brave-scoop-user-data-fix.md
Created May 18, 2023 05:03
Brave browser installed via scoop with Windows default app associated opens links in an empty data dir

Setup

  1. Install brave with scoop.sh
scoop install brave
  1. Open Brave and set it as default from Settings->Set Brave as your default browser. You can also open settings with brave://settings/
  2. Open Windows settings, go to Apps->Default apps and click on Brave in the "Set defaults for applications" list. Click on "Set default" next to "Make Brave your default browser"

Problem

Keybase proof

I hereby claim:

  • I am hosaka on github.
  • I am hosaka (https://keybase.io/hosaka) on keybase.
  • I have a public key ASDvDr38akzstzouQDsuSUPBYS2gLDa5LSSRefhYw7ivZAo

To claim this, I am signing this object:

@hosaka
hosaka / bitwise.c
Created November 4, 2015 13:15
Bitwise operation to toggle bits in memory.
#include <stdint.h>
#define LED_RED (1U << 1) // 1st bit, 0x2
#define LED_BLUE (1U << 2) // 2nd bit, 0x4
#define LED_GREEN (1U << 3) // 3rd bit, 0x8
int main() {
uint32_t reg = 0x800;
reg |= LED_RED; // set individual bits using the bitwise OR
@hosaka
hosaka / envmake.py
Created September 18, 2015 23:11
Create workspace file for sublime text from template with options for ctags and cscope generation.
#! /usr/bin/env python
#
# TODO:
# - Separate ctags from sublime function
# - Predictable template location
# - Generate template if none found
# - Total size of cscope files
# - Custom exclude folders and more project flexebility for subl/cscope/ctags
# perhaps a file list with ignored folders used by all functions
# - Remove building functions, too project specific
@hosaka
hosaka / ring_buf.c
Created August 17, 2015 12:40
Ring buffer / circular queue example in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ring_buf.h"
/* Ring bufffer / Circular buffer / Circular Queue implementation
* The queue grows from the head and shrinks from the tail
*/
@hosaka
hosaka / jump_table.cpp
Created August 10, 2015 16:34
Jump table example using function pointers in C++
#include <cstdio>
using namespace std;
// function table/jump table example
// various functions that need to be jumped to
void fa() {printf("function a\n");}
void fb() {printf("function b\n");}
void fc() {printf("function c\n");}
void fd() {printf("function d\n");}
@hosaka
hosaka / linked_list.c
Created August 10, 2015 16:34
Most simple linked list implementation in C
#include <stdio.h>
#include <stdlib.h>
// list node
typedef struct node_s
{
int data;
struct node_s *next;
struct node_s *prev;
} node_t;
@hosaka
hosaka / bin_tree.c
Created August 10, 2015 16:33
Most simple binary tree implementation in C
#include <stdio.h>
#include <stdlib.h>
// node structure
typedef struct node_s
{
int value;
struct node_s *lnode;
struct node_s *rnode;
} node_t;
@hosaka
hosaka / func_point.c
Created August 10, 2015 16:30
Usages of function pointers with structs in C
#include <stdio.h>
#include <stdlib.h>
// function pointers in C
// a function is just another address in memory which contains
// executable code, similar to getting address of a variable by using
// pointers, we can get an addr of function using function pointers
void func()
{