Skip to content

Instantly share code, notes, and snippets.

@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@joshpuckett
joshpuckett / swipeangle.js
Created February 25, 2014 19:42
Swipe Angle
view.on("touchstart", function(e) {
var touch = event.touches[0]
//Grab the initial touch coordinates
xInit = touch.pageX
yInit = touch.pageY
})
view.on("touchmove", function(e) {
var touch = event.touches[0]
xCurrent = touch.pageX
@paulirish
paulirish / bling.js
Last active July 3, 2024 20:45
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@samatjain
samatjain / Encrypted-Amazon-Cloud-Drive.md
Last active May 18, 2017 18:50
Setting up a encrypted drive on Amazon Cloud Drive w/ EncFS and acd_cli

Environment

export ACD_LOCAL=$HOME/.cache/Amazon-Cloud-Drive

# To use this file later
export ENCFS6_CONFIG=$ACD_LOCAL/encfs6.xml

Setup

mkdir -p \

@MekDrop
MekDrop / .gitlab-ci.yml
Created December 5, 2016 16:12
GitLab CI: deploy PHP website with git-ftp over sftp
# This script should work however sftp is not supported in compiled curl so not everything fine here
#
# $_CI* vars should be defined in project variables
image: mwienk/docker-git-ftp
before_script:
- eval `ssh-agent -s`
- cat > deploy.key <(echo "$CI_SERVER_KEY")
- chmod 0600 deploy.key
@omartrigui
omartrigui / make-swap.sh
Last active August 9, 2023 02:33
Create 4G swap file in Linux
#!/bin/bash
dd if=/dev/zero of=/swapfile bs=1024 count=$((1024 * 1024 * 4))
chown root:root /swapfile
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
@marfillaster
marfillaster / README.md
Last active February 1, 2023 10:07
WSL Desktop Launched i3wm

WSL Desktop Launched i3wm

Requirements VcXsrv, i3wm in wsl.

The three files below must be stored in the same directory (%UserProfile%\Desktop).

  • i3.vbs - This is the entrypoint script. It runs i3.bat in the background.
  • i3.bat - Runs VcXsrv using d0.xlaunch profile then starts i3
  • d0.xlaunch - VcXsrv in "One window without titlebar" mode at DISPLAY=:0