Skip to content

Instantly share code, notes, and snippets.

@akkys77
akkys77 / wpclisetup.md
Last active January 5, 2018 18:12
Setup WordPress wp cli to avoid linux permission issues between cli and browser
  1. Assign Wordpress (/var/www/wordpress) folder to web server user (www-data)
    sudo chown -R www-data:www-data /var/www/wordpress
  2. Find your wp-cli installation
    which wp
  3. Add user (mylinuxuser) to visudo with web server user permissions (www-data)
# perform a fresh install of Ubuntu 17.10
# upgrade the kernel to v4.13.10
mkdir ~/kernel-v4.13.10
cd ~/kernel-v4.13.10
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310_4.13.10-041310.201710270531_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-image-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
sudo dpkg -i *.deb
@akkys77
akkys77 / client.html
Created March 14, 2018 14:10 — forked from diorahman/client.html
Ajax, call jQuery POST to node.js expressjs
<html>
<head>
<title>jsonp test</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#select_link').click(function(e){
e.preventDefault();
console.log('select_link clicked');
@akkys77
akkys77 / gist:fc1d7744e60d05f4449894e27f39230e
Created April 26, 2018 13:06 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@akkys77
akkys77 / app.js
Created April 30, 2018 18:28 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@akkys77
akkys77 / AWS CLI.md
Created May 18, 2018 09:29
AWS CLI Setup / Usage Notes

What you need to do to install SDL is:

#install sdl2
sudo apt install libsdl2-dev libsdl2-2.0-0 -y;

#install sdl image
sudo apt install libjpeg9-dev libwebp-dev libtiff5-dev libsdl2-image-dev libsdl2-image-2.0-0 -y;

#install sdl mixer
@akkys77
akkys77 / pixelExport.js
Created September 2, 2019 09:21
Export open tabs from android pixel phone in History tabs
var nodeArrays = document.querySelector('#history-app').shadowRoot.querySelector('#synced-devices').shadowRoot.querySelector('#synced-device-list > history-synced-device-card:nth-child(1)').shadowRoot.querySelectorAll('#tab-item-list > div > a')
itemsArray = [...nodeArrays]
var i,j,temparray,chunk = 25, result=[], tempWindow="";
for (i=0,j=itemsArray.length; i<j; i+=chunk) {
temparray = itemsArray.map(el =>({url:el.href,hostname:el.hostname,title:el.title})).slice(i,i+chunk);
tempWindow = {title:'Window '+i/25,tabs:temparray};
result=[...result, tempWindow]
}
JSON.stringify(result)
@akkys77
akkys77 / machine.js
Last active September 28, 2020 14:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@akkys77
akkys77 / gist:2768380671b54e18637d7c4ac5da9b75
Created October 16, 2020 09:52
Extract snippets from chrome
# Tested with jq-1.6
# The script converts json entries into lines of format
# `filename[TAB]content-in-base64` and then
# for each line creates the corresponding file
# with the content decoded.
# Better be in a safe directory!!
mkdir /tmp/snippets-backup
cd /tmp/snippets-backup