Skip to content

Instantly share code, notes, and snippets.

@rightson
rightson / simple-server.py
Last active April 22, 2018 12:05
simple flask
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/store' , methods=['POST'])
def create_store():
print(request.data)
print(request.get_json())
return 'haha'
@rightson
rightson / cloudSettings
Last active June 5, 2018 02:58
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-06-05T02:58:12.185Z","extensionVersion":"v2.9.2"}
@rightson
rightson / main.c
Last active March 11, 2018 15:04
L073RZ-UART2 Example
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
** This notice applies to any and all portions of this file
* that are not between comment pairs USER CODE BEGIN and
* USER CODE END. Other portions of this file, whether
* inserted by the user or by software development tools
* are owned by their respective copyright owners.
@rightson
rightson / .hyper.js
Created February 10, 2018 14:38
My .hyper.js for Bash on Windows
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
windowSize: [1024, 768],
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',
@rightson
rightson / tty_ldisc.c
Last active February 8, 2018 10:12
TTY discipline example
struct tty_ldisc {
int magic;
char* name;
int num;
int flags;
/*
* The following routines are called from above.
*/
int (*open)(struct tty_struct*);
void (*close)(struct tty_struct*);
@rightson
rightson / config
Created January 16, 2018 03:36
Terminator config ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#000000"
[keybindings]
switch_to_tab_1 = <Alt>1
switch_to_tab_2 = <Alt>2
switch_to_tab_3 = <Alt>3
switch_to_tab_4 = <Alt>4
switch_to_tab_5 = <Alt>5
switch_to_tab_6 = <Alt>6
switch_to_tab_7 = <Alt>7
@rightson
rightson / simple-pipe-redirect.c
Last active January 10, 2018 13:11
Simple pipe and redirect
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
int main(int argc, char *argv[], char *envp[])
{
// goal: emulate the behavior of `ls -l | grep prog > output 2> errfile`
int outfd;
int errfd;
int pipefd[2];
@rightson
rightson / memory-layout.c
Created January 10, 2018 13:05
Example memory layout
#include <stdio.h>
#include <stdlib.h>
int init_global_var = 10; /* Initialized global variable */
int global_var; /* Uninitialized global variable */
static int init_static_var = 20; /* Initialized static variable in global scope */
static int static_var; /* Uninitialized static variable in global scope */
int main(int argc, char **argv, char **envp)
@rightson
rightson / memory-layout.c
Created January 10, 2018 13:05
Example memory layout
#include <stdio.h>
#include <stdlib.h>
int init_global_var = 10; /* Initialized global variable */
int global_var; /* Uninitialized global variable */
static int init_static_var = 20; /* Initialized static variable in global scope */
static int static_var; /* Uninitialized static variable in global scope */
int main(int argc, char **argv, char **envp)
@rightson
rightson / terminator.config
Last active December 20, 2017 03:35
~/.config/terminator/config
[global_config]
scroll_tabbar = True
title_font = Lucida Console Semi-Condensed 13
title_inactive_bg_color = "#000000"
title_inactive_fg_color = "#714c4c"
title_transmit_bg_color = "#000001"
[keybindings]
switch_to_tab_1 = <Alt>1
switch_to_tab_2 = <Alt>2
switch_to_tab_3 = <Alt>3