Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Piechowski grepsedawk

View GitHub Profile
View export_from_wowhead_search.js
listviewitems.map(item => item.id).filter(id => Number.isInteger(id)).map(id => 'i:' + id).join(',')
@grepsedawk
grepsedawk / block_medium
Created May 19, 2019
The iptables commands to block all traffic from Medium
View block_medium
#/bin/bash
sudo iptables --append OUTPUT -s 52.0.16.118 -j DROP
sudo iptables --append OUTPUT -s 52.1.147.205 -j DROP
sudo iptables --append OUTPUT -s 52.1.119.170 -j DROP
sudo iptables --append OUTPUT -s 52.1.173.203 -j DROP
sudo iptables --append OUTPUT -s 52.4.145.119 -j DROP
sudo iptables --append OUTPUT -s 52.4.175.111 -j DROP
sudo iptables --append OUTPUT -s 52.4.225.124 -j DROP
sudo iptables --append OUTPUT -s 52.4.240.221 -j DROP
@grepsedawk
grepsedawk / setup_monitor_postition
Last active Dec 30, 2017
Setup Monitors is Slow, setting up in .i3
View setup_monitor_postition
#!/bin/bash
LAPTOP=DP-0
TOP=HDMI-0
LEFT_INNER=DP-4
LEFT_OUTER=DP-2
xrandr --output "${TOP}" --primary --auto \
--output "${LEFT_INNER}" --right-of "${LEFT_OUTER}" \
--output "${TOP}" --right-of "${LEFT_INNER}" \
View get_vlc_location_from_reg.py
#!/usr/bin/env python3 -tt
from winreg import *
def software_path(program_key):
key = OpenKey(ConnectRegistry(None, HKEY_LOCAL_MACHINE), f'SOFTWARE\{program_key}')
for i in range(QueryInfoKey(key)[1]):
try:
subkey = EnumValue(key, i)
View github_tamper.js
// ==UserScript==
// @name GitHub Logo to Profile
// @version 0.1
// @description Make the main octocat logo take me to my profile for faster navigation
// @author Pachonk
// @match https://github.com/*
// @grant none
// ==/UserScript==
(function() {
@grepsedawk
grepsedawk / install-nodejs-binaries.sh
Created Jun 6, 2017
Install NodeJS Binaries on Linux :D
View install-nodejs-binaries.sh
#! /usr/bin/env bash
cd /tmp
wget https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
tar xf node-v6.10.3-linux-x64.tar.xz
cd node-v6.10.3-linux-x64
cp bin/node /usr/local/bin/
cp lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
View output.log
libmegaADK_Adafruit_RA8875.a(Adafruit_RA8875.cpp.obj): In function `Adafruit_RA8875::Adafruit_RA8875(unsigned char, unsigned char)':
/home/alex/Code/adafruit-test/libraries/Adafruit_RA8875/Adafruit_RA8875.cpp:667: undefined reference to `Adafruit_GFX::Adafruit_GFX(int, int)'
libmegaADK_Adafruit_RA8875.a(Adafruit_RA8875.cpp.obj):(.rodata._ZTV15Adafruit_RA8875[vtable for Adafruit_RA8875]+0xa): undefined reference to `Adafruit_GFX::startWrite()'
libmegaADK_Adafruit_RA8875.a(Adafruit_RA8875.cpp.obj):(.rodata._ZTV15Adafruit_RA8875[vtable for Adafruit_RA8875]+0xc): undefined reference to `Adafruit_GFX::writePixel(int, int, unsigned int)'
libmegaADK_Adafruit_RA8875.a(Adafruit_RA8875.cpp.obj):(.rodata._ZTV15Adafruit_RA8875[vtable for Adafruit_RA8875]+0xe): undefined reference to `Adafruit_GFX::writeFillRect(int, int, int, int, unsigned int)'
libmegaADK_Adafruit_RA8875.a(Adafruit_RA8875.cpp.obj):(.rodata._ZTV15Adafruit_RA8875[vtable for Adafruit_RA8875]+0x10): undefined reference to `Adafruit_GFX::writeFastVLine(int,
@grepsedawk
grepsedawk / BoggleSolution.rb
Last active Jan 15, 2017
This is a possible solution to a boggle board matrix in ruby.
View BoggleSolution.rb
# It should be noted that the OP requested this to
# work in a way that allows for ANY combination of
# words, not just the Boggle Standard rules
def include?(word)
word.upcase!
board.flatten!
word.each_char do |c|
return false unless board.include?(c)
board.delete_at(board.index(c))
View application_controller.rb
class ApplicationController < ActionController::Base
# this addition might/might not be needed. Try it without first.
before_action :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
devise_parameter_sanitizer.for(:account_update) { |u|
u.permit(:password, :password_confirmation, :current_password)
}
end
end
@grepsedawk
grepsedawk / stopwatch.sh
Last active Jun 26, 2019
Bash Stopwatch
View stopwatch.sh
# First install xclip (if debian based, apt-get install xclip should work)
# Add to .bashrc or .zshrc
function stopwatch() (
trap 'ctrl_c $1' INT
function ctrl_c() {
echo -n "#$1 work Development $(date -u --date @$((`date +%s` - $date1)) +%-Hh%-Mm)" | xclip -sel clip
echo "\n\n#$1 work Development $(date -u --date @$((`date +%s` - $date1)) +%-Hh%-Mm) was sent to your clipboard."
exit
}
date1=`date +%s`;