Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/bash
menu=" Minimize\n Floating Toggle\n Window Shot\n Move Workspace\n Close"
swspc () {
wspc=$(wofi -d -W 15% --prompt="Move To Worspace" --lines=2); swaymsg move window to workspace $wspc
}
active=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused) | .rect | "\(.x),\(.y)"')
@davidatsurge
davidatsurge / luasnip_config.lua
Last active January 15, 2023 13:22
luasnip+treesitter snippet that fills in prop names when creating new react component
local ls = require("luasnip")
local fmt = require("luasnip.extras.fmt").fmt
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local sn = ls.snippet_node
local rep = require("luasnip.extras").rep
-- Get a list of the property names given an `interface_declaration`
@hubenchang0515
hubenchang0515 / README.md
Created February 28, 2022 07:08
X11 截图

X11 截图

通过 xcb_get_image 可以进行截图:

xcb_get_image_cookie_t
xcb_get_image (xcb_connection_t *c,               // X连接
               uint8_t           format,          // 格式 
               xcb_drawable_t    drawable,        // 要截图的目标,例如窗口,截全屏则为 root 窗口
 int16_t x, // 截图的起点 x 坐标
@nglauber
nglauber / MainScreen.kt
Created January 3, 2021 19:46
Bottom Navigation + Jetpack Navigation
package com.example.samplecomposenavigation
import android.os.Bundle
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.List
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.*
import androidx.compose.runtime.savedinstancestate.Saver
import androidx.compose.runtime.savedinstancestate.rememberSavedInstanceState
@mre
mre / main.rs
Created March 9, 2018 01:15
A simple clone of `ls -l` in Rust
extern crate chrono;
extern crate libc;
#[macro_use]
extern crate structopt;
use std::fs;
use std::path::PathBuf;
use std::error::Error;
use std::process;
use std::os::unix::fs::PermissionsExt;
@crearo
crearo / gstreamer-tee-recording-and-display.c
Created March 20, 2017 11:47
Example of tee in gstreamer. recording + display.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;
static GstElement *pipeline, *src, *tee, *encoder, *muxer, *filesink, *videoconvert, *videosink, *queue_record, *queue_display;
/*
A Minimal Capture Program
This program opens an audio interface for capture, configures it for
stereo, 16 bit, 44.1kHz, interleaved conventional read/write
access. Then its reads a chunk of random data from it, and exits. It
isn't meant to be a real program.
From on Paul David's tutorial : http://equalarea.com/paul/alsa-audio.html