Skip to content

Instantly share code, notes, and snippets.

View Bad-ptr's full-sized avatar

Constantin Kulikov Bad-ptr

View GitHub Profile
@debloper
debloper / xrandr.sh
Last active November 10, 2025 19:52
Add system unrecognized but monitor supported resolution in X
#!/bin/bash
# Copyright (c) 2021 Soumya Deb <debloper@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@reyjrar
reyjrar / local-cpan-mirror.txt
Created November 17, 2011 03:14
Local CPAN Mirror Setup, Simply
#=======================================
# Part 1 is Setting up the Mirror Server
# Install CPAN::Mini
$ curl -L http://cpanmin.us | perl - --sudo CPAN::Mini
# Select a CPAN Mirror URL from http://mirrors.cpan.org/
# - We'll use http://cpan.pair.com
# Pick a directory to mirror to, I'll use /var/www/cpan
@cdown
cdown / gist:1163649
Last active February 13, 2026 17:17
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done
@ELLIOTTCABLE
ELLIOTTCABLE / sodomy.c
Created March 29, 2011 02:05
Sodomizing ISO C for fun and profit.
// The upshot: (in legal, sane(?) ISO C99)
type v = Namespace__foo_bar(.first = 123, .third = "non-default value!");
/* We want a function (macro.) that appears to take “named arguments,” by preprocessing into a designated
* initializer directly at the position of the function call, post-processing.
*/
// This portion is all, effectively, a neat way to define default, named arguments.