Skip to content

Instantly share code, notes, and snippets.

View grepsedawk's full-sized avatar

Alex Piechowski grepsedawk

View GitHub Profile
listviewitems.map(item => item.id).filter(id => Number.isInteger(id)).map(id => 'i:' + id).join(',')
@grepsedawk
grepsedawk / block_medium
Created May 19, 2019 00:30
The iptables commands to block all traffic from 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 December 30, 2017 16:34
Setup Monitors is Slow, setting up in .i3
#!/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}" \
#!/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)
// ==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 June 6, 2017 12:36
Install NodeJS Binaries on Linux :D
#! /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
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 January 15, 2017 06:21
This is a possible solution to a boggle board matrix in ruby.
# 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))
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 June 26, 2019 00:27
Bash Stopwatch
# 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`;