Skip to content

Instantly share code, notes, and snippets.

@unycone
unycone / Profile.ps1
Last active May 24, 2023 08:11
Profile for Windows Powershell7 to achieve bash-like behaviors
# A config file for Windows Powershell 7
# Save this as C:\Users\{username}\Documents\Powershell\Profile.ps1
# Shows navigable menu of all options when hitting Tab
Set-PSReadlineKeyHandler -Key Tab -Function Complete
# Autocompletion for arrow keys
Remove-PSReadlineKeyHandler -Key Ctrl+y
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key Ctrl+p -Function HistorySearchBackward
@unycone
unycone / keymap.c
Created January 28, 2020 07:54
dozen0
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] =
{
// Layer 0
LAYOUT(KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, \
MO(1), KC_A, KC_S, KC_D, KC_F, KC_G ),
// Layer 1
LAYOUT(KC_DEL, KC_Y, KC_U, KC_I, KC_O, KC_P, \
@unycone
unycone / keymap.c
Created September 19, 2018 03:02
Keymap for keebio iris
#include "iris.h"
#include "action_layer.h"
#include "eeconfig.h"
extern keymap_config_t keymap_config;
#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
@unycone
unycone / FlattenLayerHierarchy.js
Created May 10, 2018 18:49
A photoshop script to flatten hierarchy of layer groups without merging layers.
// Extract layers (flatten layer hierarchy, without merging) and remove empty layers
// Notice: layer effects on groups are not concerened
#target photoshop
if (!app.documents.length) {
alert('No document is opened', 'No document');
}
else {
app.activeDocument.suspendHistory('Flatten Layer Hierarchy', 'processLayers()');
}
@unycone
unycone / keymap.c
Last active December 2, 2017 06:30
A cumstom keymap configuration of QMK firmware, for DZ60 pcb (KBDfans).
/*
* keymap.c
*
* A cumstom keymap configuration of QMK firmware, for DZ60 pcb (KBDfans).
* Typically for Mac OSX.
*
* Features:
* - Splitted backspace (grave and backspace)
* - Splitted right shift (shift and FN)
* - Arrow keys are in right bottom, horizontally (left, down, up, right)
var wikipedia = require('node-wikipedia');
var getMatches = function(string, regex)
{
var matches = [];
var match = null;
while (match = regex.exec(string)) {
var ary = [];
match.forEach(function(e, i) {
if (i > 0) {
/*
* Tested in Adobe After Effects CC 2015.0.1 Release (Version 13.5.1.48)
*/
function getSelectedLayers()
{
var currentComp = app.project.activeItem;
if(currentComp instanceof CompItem) return(currentComp.selectedLayers); //Return the current selected layers
return false; //User didn't have a Comp open
}

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

@unycone
unycone / sortlayers.jsx
Created March 25, 2013 12:28
This AfterEffects script sorts layers in a composition according to their in-points.
/*
* This AfterEffects script sorts layers in a composition according to their in-points.
*
* 1. Save this file as "sortlayers.jsx".
* 2. Select a target composition in project panel of your AfterEffects.
* 3. Run "sortlayers.jsx" from Menu->"File"->"Scripts"->"Run Script File".
*/
app.beginUndoGroup("Sort layers");
var item = app.project.activeItem;
if (item != null && item instanceof CompItem) {
@unycone
unycone / youtube_webm_url.rb
Created March 15, 2013 11:35
To retrieve raw video ulrs from youtube.
require 'uri'
require 'net/http'
require 'cgi'
class ScrapeYoutube
@@youtube_url = 'http://www.youtube.com'
@@youtube_info_path = '/get_video_info?video_id='
@@key = "url_encoded_fmt_stream_map"
def self.showWebmUrl(video_id)