Skip to content

Instantly share code, notes, and snippets.

View superhawk610's full-sized avatar
🌠
drifting on a solar wind

Aaron Ross superhawk610

🌠
drifting on a solar wind
View GitHub Profile
@schmich
schmich / ducky.md
Last active May 6, 2025 15:26
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@shaggyrogers
shaggyrogers / neovim_startify_header.vim
Last active July 18, 2021 07:10
ascii art 'neovim' startify header
let s:startify_ascii_header = [
\ ' ▟▙ ',
\ ' ▝▘ ',
\ '██▃▅▇█▆▖ ▗▟████▙▖ ▄████▄ ██▄ ▄██ ██ ▗▟█▆▄▄▆█▙▖',
\ '██▛▔ ▝██ ██▄▄▄▄██ ██▛▔▔▜██ ▝██ ██▘ ██ ██▛▜██▛▜██',
\ '██ ██ ██▀▀▀▀▀▘ ██▖ ▗██ ▜█▙▟█▛ ██ ██ ██ ██',
\ '██ ██ ▜█▙▄▄▄▟▊ ▀██▙▟██▀ ▝████▘ ██ ██ ██ ██',
\ '▀▀ ▀▀ ▝▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀',
\ '',
\]
@kitze
kitze / conditionalwrap.js
Created October 25, 2017 16:54
one-line React component for conditionally wrapping children
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@stevelacey
stevelacey / routers.py
Last active October 20, 2023 07:35
Django REST Framework custom API root view with permissions filter
from collections import OrderedDict
from myproject.api.views import APIRootView
from rest_framework import permissions, routers
from rest_framework_nested.routers import NestedSimpleRouter
class Router(routers.DefaultRouter):
include_root_view = True
include_format_suffixes = False
root_view_name = 'index'
@dschep
dschep / raspbian-python3.6.rst
Last active November 21, 2024 15:10 — forked from BMeu/raspbian-python3.5.rst
Installing Python 3.6 on Raspbian

Installing Python 3.6 on Raspbian

As of January 2018, Raspbian does not yet include the latest Python release, Python 3.6. This means we will have to build it ourselves, and here is how to do it. There is also an ansible role attached that automates it all for you.

  1. Install the required build-tools (some might already be installed on your system).
@thebugcatcher
thebugcatcher / n_primes.ex
Last active February 1, 2021 09:48
Find if a number is prime in elixir and get a list of primes.
# Given an input, this program returns a list of all primes numbers less than the input.
defmodule NPrimes do
def get_primes(n) when n < 2, do: []
def get_primes(n), do: Enum.filter(2..n, &is_prime?(&1))
defp is_prime?(n) when n in [2, 3], do: true
defp is_prime?(x) do
start_lim = div(x, 2)
Enum.reduce(2..start_lim, {true, start_lim}, fn(fac, {is_prime, upper_limit}) ->
@zenorocha
zenorocha / etc-hosts-on-win.md
Last active May 19, 2025 05:25
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@glen-cheney
glen-cheney / encoding-video.md
Last active November 24, 2024 10:09
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@todgru
todgru / aws-ec2-redis-cli.md
Created June 12, 2014 23:01
AWS redis-cli on EC2