Skip to content

Instantly share code, notes, and snippets.

@3lpsy
3lpsy / readme.md
Created June 11, 2021 17:55
How to automatically launch apps in certain workspaces in SwayWM

Fun Stuff

I recently figured out how to launch applications in sway on login (or config reload) in specific workspaces. I tried doing this a year or so ago using procedural calls to swaymsg with manual changes to workspaces but it failed due to the delay in launching apps (the workspace would change too quickly). However, I recently figured out how to actually do it by combining swaymsg with assign.

First, you'll want to get the app_id, class or title of window you want to launch. Then you'll want to add it to the your sway config file.

The syntax looks like:

@jeffchiou
jeffchiou / wrap.js
Created December 14, 2019 22:13
Wrapping an Element with Another, using modern JS and compatible JS
/**
* Wrapper function with modern JS. May have issues with IE and Safari.
* Will preserve event handlers.
* @param {ChildNode} elToWrap The element you want to wrap.
* @param {ParentNode} wrapper The element to wrap with.
*/
const wrap = (elToWrap, wrapper) => {
elToWrap.before(wrapper) // so element doesn't move
wrapper.append(elToWrap) // automatically moves wrapped element.
}
@edokeh
edokeh / index.js
Last active May 10, 2024 11:02
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 10, 2024 11:02
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@saoudrizwan
saoudrizwan / TaskManager.swift
Last active May 10, 2024 10:56
Handle multiple network requests with the same URL efficiently with a shared task manager
import Foundation
class TaskManager {
static let shared = TaskManager()
let session = URLSession(configuration: .default)
typealias completionHandler = (Data?, URLResponse?, Error?) -> Void
var tasks = [URL: [completionHandler]]()
@Asjas
Asjas / reset.css
Created May 19, 2021 07:09
Modern CSS Reset - Andy Bell
// https://piccalil.li/blog/a-modern-css-reset
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
@disler
disler / ADA_v2_README.md
Created April 17, 2024 18:01
Personal AI Assistant: 'Ada' - v0.2

This is not working complete code.

This is strictly a v0.2, scrapy, proof of concept version of a personal AI Assistant working end to end in just ~726 LOC.

This is the second iteration showcasing the two-way prompt aka multi-step human in the loop. The initial, v0, assistant version is here.

It's only a frame of reference for you to consume the core ideas of how to build a POC of a personal AI Assistant.

To see the high level of how this works check out the explanation video. To follow our agentic journey check out the @IndyDevDan channel.

@schirrmacher
schirrmacher / AppleDeviceCheckService.ts
Last active May 10, 2024 10:50
DeviceCheck Backend Example Implementation for Validating iOS Device Authenticity
import jwt from "jsonwebtoken";
import uuid from "uuid";
import config from "../../../config";
import { DeviceCheckService, DeviceCheckParams } from "./DeviceCheckService";
import BaseService from "./BaseService";
export class AppleDeviceCheckService extends BaseService implements DeviceCheckService {
@kennypete
kennypete / navigating_the_modes_of_Vim.md
Created April 18, 2024 20:46
Navigating the modes of Vim

Navigating the modes of Vim

This diagram illustrates navigating through Vim’s modes. It was built factoring Vim 9 (i.e., all its modes, including up to two new modes, cr and cvr, in November 2023). Information about the state() and 'showmode' is provided too.

SVG version

Some features are only available in the SVG version. It is not provided directly from within this gist’s files because SVGs do not always play nicely in GitHub (particularly, refusing to display embedded fonts).

The SVG version includes hover text help, which shows pertinent information about the underlying key, command, mode, etc.

@n0mi1k
n0mi1k / ipagrabber.py
Last active May 10, 2024 10:47
.IPA file extracter for Apple Configurator
import os
import shutil
"""
Steps to retrieve the IPA file from the Configurator app:
1. Install Apple Configurator from the Mac App Store and sign in
2. Connect your iOS device to your Mac
3. Select "Add > Apps..." and search for the app you want to install, click "Add"
4. The newer Apple Configurator deletes the IPA after installing it, so you'll need to use this tool to grab it