Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Ashley Connor ashleyconnor

🏠
Working from home
View GitHub Profile
@ashleyconnor
ashleyconnor / console.js
Last active January 26, 2023 06:04
Rip Activity History from Blind
View console.js
// continually scroll to the bottom to load all comments
let comments = document.querySelectorAll("div.contents.c_activity li");
[...comments].map((el) => {
let link = el.querySelectorAll(":scope a")[0].href
let text = el.querySelectorAll(":scope a")[0].innerText.trim();
let date = el.querySelectorAll(":scope span.date")[0].innerText.trim();
let detail = el.querySelectorAll(":scope div.detail")[0].innerText.trim();
@ashleyconnor
ashleyconnor / create_twitter_image.sh
Last active November 18, 2022 00:01
Creates a twitter sized image filling in the background with the dominate image color
View create_twitter_image.sh
#!/bin/bash
export PATH=/usr/local/bin/:$PATH
for f in "$@"
do
hexcode=$(convert "$f" -format %c -depth 8 histogram:info:- | sort -n | tail -1 | awk '{ print $3 }')
convert "$f" -resize 1600x900 -background "$hexcode" -gravity center -extent 1600x900 "$f".twitter.png
done
@ashleyconnor
ashleyconnor / transmission_unrar_docker.sh
Created May 15, 2022 01:47
Tranmission script to automatically unrar downloads if required
View transmission_unrar_docker.sh
#!/bin/bash
#A simple script to extract a rar file inside a directory downloaded by Transmission.
#It uses environment variables passed by the transmission client to find and extract any rar files from a downloaded torrent into the folder they were found in.
find /"$TR_TORRENT_DIR"/"$TR_TORRENT_NAME" -name "*.rar" -execdir docker run --rm -v "$PWD":/files maxcnunes/unrar:latest unrar e -o- -r "{}" \;
@ashleyconnor
ashleyconnor / keybindings.json
Last active December 22, 2020 18:26
VSCode jump to tab keyboard shortcuts OSX
View keybindings.json
{
"key": "cmd+0",
"command": "workbench.action.openLastEditorInGroup"
},
{
"key": "cmd+1",
"command": "workbench.action.openEditorAtIndex1"
},
{
"key": "cmd+2",
View gist:9d2f0ff16b9e7423eddef927af6a2264
> echo.py
print("Hello World")
> echo.php
<?php
$command = escapeshellcmd('python echo.py');
$output = shell_exec($command);
echo $output;
View gist:ebc86c2c21211ceb5763c2bff97ebce6
$ docker run --name my-redis -d redis
$ docker run -it --pid=container:my-redis \
--net=container:my-redis \
--cap-add sys_admin \
alpine sh
@ashleyconnor
ashleyconnor / processify.py
Created December 4, 2018 19:51 — forked from schlamar/processify.py
processify
View processify.py
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
'''Decorator to run a function as a process.
Be sure that every argument and the return value
View error.js
// deps
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-redux": "^5.0.2",
"react-router": "next",
"react-router-redux": "next",
"redux": "^3.6.0",
"redux-logger": "^2.8.1"
// index.js
@ashleyconnor
ashleyconnor / react-router-component.js
Created January 5, 2017 02:50
Testing component that uses react-router props
View react-router-component.js
/// Route
import React from 'react';
import { Router, Route } from 'react-router';
import Profile from './components/Profile';
const Routes = (props) => (
<Router {...props}>
<Route path="/profile/:username" component={Profile} />
@ashleyconnor
ashleyconnor / async-await.js
Created December 4, 2016 14:56
async/await example
View async-await.js
async function main () {
try {
const res = await fetch('https://api.github.com/orgs/facebook');
const json = await res.json();
console.log(json);
} catch (e) {
// handle error
}
}