Skip to content

Instantly share code, notes, and snippets.

View shurizzle's full-sized avatar
🤌

shurizzle shurizzle

🤌
  • Vodafone, Internet
View GitHub Profile
#!/usr/bin/env ruby
# who the fuck said Ruby couldn't be hacky, NEVER DO THIS IT IS STUPID
# AND DOING IT WRONG TOO
require 'socket'
# DEBUG {{{
class TCPSocket
alias __gets__ gets
def gets(*args)
@shurizzle
shurizzle / gist:893694
Created March 30, 2011 01:23
FastCGI dispatcher for Padrino in ruby 1.9.x (needed for lighty)
#!/usr/bin/env ruby
# require rack fastcgi {{{
require 'rack/handler/fastcgi'
# support for ruby 1.9.x {{{
class FCGI; class ValuesRecord
def self::read_length(buf)
if buf.getbyte(0) >> 7 == 0
buf.slice!(0, 1).getbyte(0)
@shurizzle
shurizzle / euler.rb
Created April 28, 2011 14:54
Euler Project 1-50 in a cool ruby dsl
# Usage example:
# ruby -r/path/to/this/file 'Euler.execute 1'
# library {{{
require 'benchmark'
require 'fffs'
fs = FFFS::FileSystem.parse(__FILE__ == $0 ? DATA : File.read(__FILE__).split(/^__END__$/, 2).last) #DATA doesn't work if required
class NilClass
@shurizzle
shurizzle / gist:1223923
Created September 17, 2011 13:14
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
require 'net/http'
require 'clipboard'
@mathiasbynens
mathiasbynens / .gitignore
Last active February 5, 2023 08:47
Generating a regular expression to match valid JavaScript identifiers (like https://mathiasbynens.be/demo/javascript-identifier-regex) in Node.js
package-lock.json
node_modules
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@hunterbridges
hunterbridges / twitch_irc.md
Last active May 26, 2024 13:02
How to connect to Twitch with an IRC client (As of Oct 2015)

HOWTO

Connect to Twitch.tv chat with an IRC client

  1. Visit this website and get an OAuth Token for your Twitch account.
  2. Add a server to your IRC client with this configuration, using your OAuth Token as the server password. Make sure it is not using SSL.
{
  address = "irc.twitch.tv";
chatnet = "Twitch";
@dhinus
dhinus / youtube360check.js
Created March 14, 2016 13:26
Check if browser supports Youtube 360 video
function browserSupports360 () {
// YouTube supports 360 videos in a limited set of browsers,
// see https://support.google.com/youtube/answer/6178631
var ua = navigator.userAgent;
// No mobile browser is supported at the moment
if (/Mobile/.test(ua) || /Tablet/.test(ua)) return false;
// Chrome >= 40
@ssaavedra
ssaavedra / 57-add-emoji-support.conf
Created June 19, 2016 10:36
Add Emoji to Linux Fontconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
EmojiOne Color SVGinOT Font
Author: Santiago Saavedra <ssaavedra@gpul.org>
License: CC0
Year: 2016
Install:
@thacoon
thacoon / arch-linux-gnome-install
Last active June 24, 2024 10:31
Install a minimal gnome setup and some more useful things
# Install Gnome and some other useful thins
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# And based on https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger
# I have just copied commands from https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger#Weitere_notwendige_Dienste
# It's just to have it with one view after doing a [fresh installation](https://gist.github.com/thacoon/05d5a39606ab554455d6713e8a714b2c)
# Some useful services
pacman -S acpid ntp dbus cups cronie