Skip to content

Instantly share code, notes, and snippets.

View curiositry's full-sized avatar

Curiositry curiositry

View GitHub Profile
@SidharthArya
SidharthArya / alttab
Last active November 17, 2023 22:50
Sway Windows Manager Alt Tab behavior
#!/usr/bin/env python3
import sys
import json
import subprocess
direction=bool(sys.argv[1] == 't' or sys.argv[1] == 'T')
swaymsg = subprocess.run(['swaymsg', '-t', 'get_tree'], stdout=subprocess.PIPE)
data = json.loads(swaymsg.stdout)
current = data["nodes"][1]["current_workspace"]
@curiositry
curiositry / format_manuscripts.sh
Last active March 30, 2017 17:19
A little bash script to format manuscripts with Pandoc
#!/bin/sh
echo "Formatting manuscripts..."
for i in "$@"
do
case $i in
-f=*|--filename=*)
FILENAME="${i#*=}"
shift # past argument=value
@Pushplaybang
Pushplaybang / free-meteor-deployment-heroku.md
Last active July 29, 2019 13:38
no frills instructions for getting meteor up on a free heroku and mongolab instance, no credit card required.

Prerequisites

You're going to need to create accounts at both Heroku and mlab, get the heroku toolbelt, create a database and get the full db url with the credentials.

  1. Have a meteor project you want to deploy setup on GIT
    • if your not yet on git, you'll need to get up to speed before proceeding with this, of course you should be on git, versioning all your work, and luckily getting started is pretty easy. You'll also need a github account to follow this tutorial.
  2. Setup a Heroku Account here
  3. Setup a mongo lab account
  4. Install the Heroku tool belt
  5. create a new db on mlab
  6. create a new user for that db
@Pengor
Pengor / IteratedToTimed.py
Created April 8, 2015 03:27
Converts iterated data to timed data. For use with OpenBCI output files.
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("in_file", type=str)
parser.add_argument("out_file", type=str)
args = parser.parse_args()
inFile = open(args.in_file,'r')
outFile = open(args.out_file,'w')
@Photosynthesis
Photosynthesis / convert_obci_csv_to_openvibe.py
Last active July 25, 2019 09:44
Convert OpenBCI CSV data to Openvibe format
import csv
import os
import sys
''' CONFIG '''
# PATHS
''' Path relative to this script for input data files '''
input_path = 'input'
@curiositry
curiositry / _opentype-features.scss
Created March 4, 2014 05:51
A basic SASS mixin that makes OpenType features easier to work with on the web.
@mixin openTypeFeatures(
$discretionary,
$historical,
$proportional-nums,
$tabular-nums,
$oldstyle-nums,
$lining-nums,
$superscript,
$subscript,
$scientific-inferiours,
@curiositry
curiositry / url_slugger.php
Created December 5, 2013 21:09
A function to convert strings to SEO friendly URL slugs from www.cubiq.org
setlocale(LC_ALL, 'en_US.UTF8');
function toAscii($str, $replace=array(), $delimiter='-') {
if( !empty($replace) ) {
$str = str_replace((array)$replace, ' ', $str);
}
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
@curiositry
curiositry / smooth_scroll.js
Created September 29, 2013 00:39
A handy smooth scroll snippet that requires no extra markup and breaks modals.
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
@curiositry
curiositry / gradient_line
Created August 28, 2013 18:47
A neat gradient line snippet. Dependent on flexbox_functions.php. You could use the straight flexbox code or some other alignment system.
.gradient_line{
<?php flexbox::align_items_center(); ?>
height: 1px;
background: black;
width: 100%;
background: -webkit-gradient(linear, 100% 100%, 0 0, from(white), to(white), color-stop(50%, black));
background: -moz-linear-gradient(left, #FFF 0%, #444 50%, #fff 100%);
background: -o-gradient(linear, 0 0, 100% 0, from(white), to(white), color-stop(50%, black));
clear:all;
}
@curiositry
curiositry / CSS_headers_and_compression
Created August 28, 2013 18:44
For those using PHP as a CSS preprocessor, this snippet sets the headers and also enables gzipping.
<?php ob_start ("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>