Skip to content

Instantly share code, notes, and snippets.

View crahan's full-sized avatar

Thomas Bouve crahan

View GitHub Profile
@3lpsy
3lpsy / x-resize
Last active March 27, 2025 03:24
Manual Implementation of Auto Resizing For Non-Gnome Environments (like XFCE) running under Spice/Libvirt
#!/bin/bash
# SPDX-License-Identifier: MIT License
# Steps:
# 1) Make sure bash is available
# 2) Create udev rule
# - path to new udev rule: /etc/udev/rules.d/50-x-resize.rules
# - udev rule content:
# ACTION=="change",KERNEL=="card0", SUBSYSTEM=="drm", RUN+="/usr/local/bin/x-resize"
# 3) Create /var/log/autores directory
# 4) Create script /usr/local/bin/x-resize (this file) and make executable
@Ardillo
Ardillo / js
Created December 17, 2019 22:37
window.setInterval(thanosify, 2000);
function thanosify(){
[].forEach.call(document.querySelectorAll('.player'), function (el) {
if (el.className.includes("me")) {
console.log(el)
} else {
el.style.visibility = 'hidden'
}
});}
@mak
mak / wcr.py
Last active October 28, 2018 21:09
Extract everything from WannaCry
import re
import os,sys
import pefile
import struct
import zipfile
import hashlib
import StringIO
from Crypto import Random
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5,AES
@ttscoff
ttscoff / tm.completion.bash
Last active February 20, 2025 09:42
Fuzzy Bash completion for tmux session/window using [tm](http://brettterpstra.com/2014/05/11/making-my-tmux-life-easier/)
_tm_complete() {
local rx
local token=${COMP_WORDS[$COMP_CWORD]}
local IFS=$'\t'
local words
if [ $COMP_CWORD -eq 2 ]; then
words=$(tmux list-windows -t ${COMP_WORDS[1]} 2> /dev/null | awk '{print $2}' | tr -d '*-' | tr "\n" "\t")
elif [ $COMP_CWORD -eq 1 ]; then
words=$(tmux -q list-sessions 2> /dev/null | cut -f 1 -d ':' | tr "\n" " ")
fi
#!/bin/bash
# Bash completion for `up` <http://brettterpstra.com/2014/05/14/up-fuzzy-navigation-up-a-directory-tree/>
_up_complete()
{
local rx
local token=${COMP_WORDS[$COMP_CWORD]}
local IFS=$'\t'
local words=$(dirname `pwd` | tr / " ")
local nocasematchWasOff=0
@ttscoff
ttscoff / up.sh
Last active February 20, 2025 09:42
up: Quickly cd up a directory tree
# inspired by `bd`: https://github.com/vigneshwaranr/bd
function _up() {
local rx updir
rx=$(ruby -e "print '$1'.gsub(/\s+/,'').split('').join('.*?')")
updir=`echo $PWD | ruby -e "print STDIN.read.sub(/(.*\/${rx}[^\/]*\/).*/i,'\1')"`
echo -n "$updir"
}
function up() {
if [ $# -eq 0 ]; then
@ttscoff
ttscoff / tm.bash
Last active September 10, 2024 19:55
A shell function to wrap tmux and make the basic commands a bit easier
#!/bin/bash
__lower() {
echo "$@"|tr "[:upper:]" "[:lower:]"
}
__menu() {
local result=""
PS3=$1
shift
@ttscoff
ttscoff / total_numbers.rb
Created April 7, 2014 19:42
Sum all numbers found in the input
#!/usr/bin/ruby
decimal = "."
separator = ","
if RUBY_VERSION.to_f > 1.9
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
input = STDIN.read.force_encoding('utf-8')
else
@pjaspers
pjaspers / gist:9131345
Last active April 28, 2022 07:52
ICQ list.
000787466 @bramus
006904094 @inferis
008093150 @tomklaasen
010686174 @to1ne
011006380 @tijs
023055424 @crahan
063846821 @junkiesxl
075540649 @maxvoltar
084511154 @atog
102812969 @nilo
@ttscoff
ttscoff / getpinboard.rb
Created December 27, 2013 23:37
Pinboard to Mavericks tags
#!/usr/bin/ruby
##############################################################################
### getpinboard.rb by Brett Terpstra, 2011 <http://brettterpstra.com>
### Retrieves Pinboard.in bookmarks, saves as local .webloc files for
### Spotlight searching.
###
### Optionally adds OpenMeta tags and/or saves page as PDF (see config below)
### Use -r [NUMBER OF DAYS] to reset the "last_checked" timestamp (primarily
### for debugging).
###