Skip to content

Instantly share code, notes, and snippets.

@morsdyce
morsdyce / decrypt-pdf.sh
Created July 10, 2023 08:40 — forked from okvv/decrypt-pdf.sh
bash script to bulk remove password from (pdf) files in current directory using qpdf
#!/usr/bin/env bash
for f in *
do qpdf --password=THE_PASSWORD --decrypt --replace-input $f;
done
# brew install qpdf
# for executable file run: chmod u+x decrypt-pdf.sh
@morsdyce
morsdyce / mockup.md
Last active May 30, 2022 14:50 — forked from adamkleingit/mockup.md
Timer App

Timer App

Please create an app for managing timed tasks.

  1. The user can input a text and click Add
  2. A new task is added with the title, and 00:00 time, and a play button.
  3. Clicking Play will play this task: the timer will start running, and the icon will change to a pause icon. Also - any other running task will be paused.
  4. Clicking Pause will pause the task.
  5. The total time is always updated.
@morsdyce
morsdyce / hoc-template.tsx
Created October 23, 2019 15:36 — forked from rosskevin/hoc-template.tsx
Typescript higher order component (hoc) template
/* variation on https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1 */
import * as React from 'react'
import { wrapDisplayName } from 'recompose'
// Props you want the resulting component to take (besides the props of the wrapped component)
interface ExternalProps {}
// Props the HOC adds to the wrapped component
export interface InjectedProps {}
@morsdyce
morsdyce / largestFiles.py
Created August 14, 2017 07:28 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
@morsdyce
morsdyce / raspberry-pi-vpn-router.md
Created October 24, 2016 02:47 — forked from superjamie/raspberry-pi-vpn-router.md
Raspberry Pi VPN Router

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@morsdyce
morsdyce / gist:b5c5a307102216af2261820c24c7f65a
Created July 7, 2016 08:09 — forked from ydn/gist:320165
Use YQL to convert XML to JSON in your sleep
<!-- Use YQL to convert XML to JSON in your sleep -->
<!-- Introduced in YDN blog post: http://developer.yahoo.net/blog/archives/2010/03/yql_code_samples_yql_is_easy_to_use.html -->
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<ul>UN Headlines:</ul>
<script>
var Y = new YUI();
function handleResponse ( json ) {
var items = json.query.results.item;
for ( var i = 0; i < items.length; i++ ) {
/*
* This plugin makes sure karma doesn't run any specs when there's a
* compilation error in a module by including a module even if the module has errors.
*
* Webpack's normal behaviour is to not include modules which have errors,
* which causes Karma to run all the tests without the failed spec.
*
* Some links to where this magic actually happens in Webpack:
*
var webpackConfig = {
plugins: [
// Plugin to show any webpack warnings and prevent tests from running
function () {
this.plugin("done", function (stats) {
if (stats.compilation.warnings.length) {
// Log each of the warnings
stats.compilation.warnings.forEach(function (warning) {
console.log(warning.message || warning);
});
@morsdyce
morsdyce / what-forces-layout.md
Created September 28, 2015 10:42 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()