Skip to content

Instantly share code, notes, and snippets.

View squirrel532's full-sized avatar

Squirrel squirrel532

View GitHub Profile
Th is a note for those who want to build `qmk/g60ble` firmware for their BIOI G60BLE keyboard.
1. Replace vid by `0x8101` in `info.json`. I wrote this gist based on release `0.22.14` because qmk might change in the future.
1. There is a typo in `LAYOUT_60_hhkb` keymap that maps top-right key into nothing.
The correct config of that key:
```
{"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}
```
@squirrel532
squirrel532 / SQL Cheat Sheet.md
Created October 13, 2020 09:42 — forked from janikvonrotz/SQL Cheat Sheet.md
SQL Cheat Sheet#SQL#Markdown

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

Datatypes

Text types

@squirrel532
squirrel532 / install_vim.sh
Created June 14, 2020 15:13
Build vim from source on macOS
git clone https://github.com/vim/vim
cd vim
./configure --with-features=huge --enable-multibyte \
--enable-python3interp=yes \
--with-python3-config-dir=$(python3-config --configdir) \
--enable-luainterp=yes \
--enable-cscope \
--prefix=/usr/local \
--with-luajit \
[tool.poetry]
name = "hello"
version = "2020.02.27"
description = "zzzz"
authors = ["aarrr <aarrrr@example.com>"]
[tool.poetry.dependencies]
python = "~2.7 || ~3.7"
pytest = "*"
@squirrel532
squirrel532 / pre-commit
Created September 20, 2018 07:35 — forked from samhemelryk/pre-commit
A git pre-commit hook example.
#!/bin/bash
#
# This pre-commit hook checks that you havn't left and DONOTCOMMIT tokens in
# your code when you go to commit.
#
# To use this script copy it to .git/hooks/pre-commit and make it executable.
#
# This is provided just as an example of how to use a pre-commit hook to
# catch nasties in your code.
@squirrel532
squirrel532 / git-filter-branch-move-files.md
Created July 24, 2018 17:03 — forked from fabiomaggio/git-filter-branch-move-files.md
Use git filter-branch to move all projects files to a subdir and rewrite all commits
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
  • Existing tags are updated
@squirrel532
squirrel532 / General Makefile
Created May 22, 2017 15:57 — forked from reecer/General Makefile
A general makefile for general-purpose C projects.
CC=gcc
CCFLAGS=-Wall
LDFLAGS=
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:.c=.o)
TARGET=des
all: $(TARGET)
$(TARGET): $(OBJECTS)
#!/bin/bash
device=$1
cmd=$2
username="username_on_device"
IDENTITY_FILE="/path/to/key"
case $cmd in
"shutdown") ssh $username@localhost -i $IDENTITY_FILE -p $device -At sudo shutdown -h now ;;
#include <stdio.h>
/*
This function, rec will prints all number between va and vb
in diminishing order.
rec(1, 5) and rec(5, 1) give same output.
*/
int rec(int va, int vb) {
(va > vb) && printf("%d\n", va);
(vb >= va) && printf("%d\n", vb);
return va != vb && rec(va - (va>vb), vb - (vb > va));
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <assert.h>
inline void swap_char(char *a, char *b) {
*a ^= *b; *b ^= *a; *a ^= *b;
}