Skip to content

Instantly share code, notes, and snippets.

View MyriaCore's full-sized avatar

MyriaCore MyriaCore

View GitHub Profile
@dumptruckman
dumptruckman / snake_case.py
Created November 18, 2020 17:43
Python class decorator for accessing lowerCamelCase attributes using snake_case.
from typing import Any
def snake_to_camel(name):
components = name.split('_')
return components[0] + ''.join(x.title() for x in components[1:])
def snake_case_attrs(klass):
"""A class decorator that enables getting and setting of attributes with lowerCamelCase names using snake_case."""
@bin2415
bin2415 / ghidraCFG.py
Last active August 16, 2024 09:33
Python script of Ghidra to dump cfg
#TODO write a description for this script
#@author Chengbin, MyriaCore
#@category Functions
#@keybinding
#@menupath
#@toolbar
#TODO Add User Code Here
@katef
katef / life-utf8.c
Last active September 8, 2024 05:59
XBM to UTF-8 braille image things
/*
* John Conway's Game of Life.
*
* This is written for POSIX, using Curses. Resizing of the terminal is not
* supported.
*
* By convention in this program, x is the horizontal coordinate and y is
* vertical. There correspond to the width and height respectively.
* The current generation number is illustrated when show_generation is set.
*
(define-module (discord)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system trivial)
#:use-module (gnu packages base)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages xml)
#:use-module (gnu packages elf)
#:use-module (gnu packages compression)
#:use-module (gnu packages linux)
@ericnormand
ericnormand / 00_script.clj
Last active May 18, 2024 08:30
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@pjeby
pjeby / shelldown-demo
Last active September 17, 2024 13:45
"You got your markdown in my shell script!" "No, you got your shell script in my markdown!"

Mixed Markdown and Shell Scripting

: By the power of this magic string: ex: set ft=markdown ;:<<'```shell' #, this file is now both a markdown document and an executable shell script. chmod +x it and try running it!

The above line does just what it says. More specifically, when placed within in the first 5 lines and preceded only by blank lines or #-prefixed markdown headers:

  1. The first part of the magic string makes github and various editors (e.g. atom with the vim-modeline packge) treat the file as having markdown syntax (even if the file doesn't have an extension)
  2. The second part (if run in a shell), makes the shell skip execution until it encounters the next ```shell block.

(The line also has to start with a : so that it's valid shell code.)

@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active September 25, 2024 14:07
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@arohner
arohner / google-api.clj
Created November 5, 2016 21:53
Clojure example of accessing google APIs directly
(ns example.api.google
(:require [cemerick.url :as url]
[cheshire.core :as json]
[clj-jwt.core :as jwt]
[clj-jwt.key :as key]
[clj-time.core :as time]
[clj-http.client :as http]
[clojure.string :as str])
(:import java.io.StringReader))
@Shou
Shou / discord_webm.user.js
Last active July 10, 2022 20:02
Discord WebM embedder
// ==UserScript==
// @name Discord WebM embed
// @description Embeds uploaded and linked WebM files
// @namespace Shou
// @include https://discordapp.com/channels/*
// @version 1
// ==/UserScript==
var styleElem;
@dherman
dherman / emacs-cheat-sheet.md
Created August 2, 2012 16:22
My emacs cheat sheet

In penance for cracking stupid jokes on Twitter, here's my Emacs cheat sheet. Emacs has a steep learning curve, so I've tried to order them by importance so you could learn them in stages.

One overall rule of thumb: pay attention to the minibuffer (the line at the bottom of the editor). It will often guide you through a process, and also gives you hints about what state you're in, such as the middle of a multi-chord sequence.

The other rule of thumb: when in doubt, C-g it out.

Basics (mandatory)

You simply can't get by without having these at your fingertips.