Skip to content

Instantly share code, notes, and snippets.

View alanszlosek's full-sized avatar

Alan Szlosek Jr alanszlosek

View GitHub Profile
00:00:00.000 [INFO] [sway/main.c:346] Sway version 1.6-ad2e13dad1 (Jun 6 2021, branch 'master')
00:00:00.002 [INFO] [sway/main.c:154] Linux black 5.10.43-0-lts #1-Alpine SMP Fri, 11 Jun 2021 07:41:12 +0000 i686 Linux
00:00:00.003 [INFO] [sway/main.c:170] Contents of /etc/os-release:
00:00:00.003 [INFO] [sway/main.c:154] NAME="Alpine Linux"
00:00:00.003 [INFO] [sway/main.c:154] ID=alpine
00:00:00.003 [INFO] [sway/main.c:154] VERSION_ID=3.14.0
00:00:00.003 [INFO] [sway/main.c:154] PRETTY_NAME="Alpine Linux v3.14"
00:00:00.003 [INFO] [sway/main.c:154] HOME_URL="https://alpinelinux.org/"
00:00:00.003 [INFO] [sway/main.c:154] BUG_REPORT_URL="https://bugs.alpinelinux.org/"
00:00:00.003 [INFO] [sway/main.c:142] LD_LIBRARY_PATH=
@alanszlosek
alanszlosek / sugar.sh
Last active June 9, 2020 11:48
Build script for Sugar under Debian
#!/bin/bash
set -e
# install git if not present
[ ! -e /usr/bin/git ] && sudo apt install -y git
# clone the sugar modules
for x in sugar{-datastore,-artwork,-toolkit-gtk3,} gwebsockets; do
if [ ! -e ${x} ]; then
@alanszlosek
alanszlosek / google-keep.js
Created November 21, 2015 23:08
Crawl Google Keep entries, concatenate them all, and print to the console. Right click on the console entry to save as a single file.
/*
Inspect your google keep items and find the appropriate container selector, and those for the title and item body divs.
*/
var items=document.querySelectorAll('.IZ65Hb-n0tgWb.IZ65Hb-WsjYwc-nUpftc.RNfche');
var out = '';
for(var i = 0; i < items.length; i++) {
var item = items[i];
var text = item.querySelector('.IZ65Hb-YPqjbf.r4nke-YPqjbf[contenteditable="false"]');
if(text && text.innerText.length > 0) {
<?php
error_reporting(E_ALL);
$a = new stdClass();
$a->name = 'Zzzz';
$b = new stdClass();
$b->name = 'Bbbb';
<html>
<head>
<script>
/*
Descends into an array or JSON object, looking for the specified elements
If one is not found, the fallback value (first argument) will be returned
Trying to alleviate the mix of error checking and object access that can litter code
*/
Object.prototype.dive = function() {
var source = this;
@alanszlosek
alanszlosek / javascript-injection.txt
Created March 28, 2012 20:55
JavaScript injection example
<!DOCTYPE html>
<html>
<body>
<h1>Example Scenario</h1>
<p>Save this locally as an HTML file and try it out. Open it and then look in your Firebug
or developer console. More details here:
http://blog.alanszlosek.com/post/20077489479/tag-stripping-not-sufficient-to-prevent-javascript</p>