This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Find bad Python AUR packages on Arch Linux | |
# Simply run the script and it should show you what needs updating | |
# Non-destructive. Arch Linux only. Will show incorrect results when multiple Python versions are installed side by side. | |
# Intended to provide tech support to people updating complex python projects from the AUR | |
real_python_dir=$(pacman -Ql python | grep /usr/lib/python | head -1 | cut -d/ -f-4 | cut -d' ' -f2) | |
set -- /usr/lib/python3.* | |
for d do | |
if [ -e "$d" ] && [ "$d" != "$real_python_dir" ]; then | |
set -- "$@" "$d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int chday(int day, int month, int year); | |
int chmonth(int month); | |
int chyear(int year); | |
int leapYear(int y); | |
int day_of_year(int d, int m, int y); | |
int chday(int day, int month, int year) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import itertools | |
import yaml | |
import sys | |
class MultiDict(dict): | |
def add(self, key, value): | |
if key not in self: | |
self[key] = [] | |
self[key].append(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ref: http://andrewhfarmer.com/hide-discord-sidebar/ | |
var cmd$ = $; | |
document.addEventListener('keydown', function(event) { | |
if (event.metaKey && event.keyCode === 220) { | |
// Toggle visibility of the channel and guilds columns | |
var channelWrap = cmd$('.flex-vertical.channels-wrap'); | |
var guildsWrap = cmd$('.guilds-wrapper'); | |
var titleWrap = cmd$('.title-wrap'); | |
if (channelWrap.getAttribute('style') === 'display: none') { | |
channelWrap.setAttribute('style', ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for l in __import__('fileinput').input():print(*[((c,chr(ord(c)+65248))[ord(c)<127]," ")[c==" "]for c in l[:-1]],sep='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -CS -Mutf8 -pe'y/ !-~/ !-~/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@worlds = 1..94; | |
for (@worlds) { | |
# This would probably work on Windows with "-c1" changed to "-n 1" | |
open $pings[$_], '-|', qw/ping -c1/, "oldschool$_.runescape.com"; | |
} | |
undef $/; | |
for (@pings[@worlds]) { | |
if (<$_> =~ /time=([\d.]+ ?ms)/) { | |
$_ = $1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo openvt -s -- sh -c "sudo -u charles -- vlock -a; chvt $(fgconsole)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/busybox sh | |
# Original code, slow, not sh-compatible | |
hashcode() { | |
local hash=0 | |
local str="$1"X | |
while [ -n "$str" ]; do | |
ch="${str:0:1}" | |
hash=$(( ($hash * 173 + $(printf '%d' "'$ch")) % 256 )) | |
str="${str:1}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec git log --oneline --graph --format='%C(yellow)%h %C(bold blue)%an %C(reset)%s %C(green)%GG%C(yellow)%D' "$@" |
NewerOlder