Skip to content

Instantly share code, notes, and snippets.

View girasquid's full-sized avatar
🦐

Luke Hutscal girasquid

🦐
View GitHub Profile
@iamnewton
iamnewton / bash-colors.md
Last active May 2, 2025 13:25
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
package text {
import flash.text.TextFormat;
public class SimpleFormat extends TextFormat {
public function SimpleFormat(options:Object):void {
for(var k:Object in options) {
if(this.hasOwnProperty(k)) {
this[k] = options[k];
}
}
@keimoon
keimoon / fix_heartbleed.sh
Created April 10, 2014 03:57
OpenSSL Heartbleed patch
#!/usr/bin/env bash
DIR=`dirname $BASH_SOURCE`
test "x`whoami`" != "xroot" && echo "Please run as root" && exit
version=`openssl version`
version=${version:0:14}
test "x$version" == 'xOpenSSL 1.0.1g' && echo "OpenSSL version 1.0.1g is OK!!!" && exit
echo -n "Your OpenSSL version is $version. Are you sure to upgrade to 1.0.1g? [Y/n]: "
read confirm
test "x$confirm" != "xY" && echo "Bye" && exit
echo "Checking openssl in /usr/local/bin"
@csfrancis
csfrancis / gdb_ruby_backtrace.py
Last active June 25, 2024 19:12
Dump an MRI call stack from gdb
# Updated for Ruby 2.3
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@fw42
fw42 / gist:93727d046b827fab4751
Last active August 29, 2015 14:08
Module#prepend with C extensions
#!/usr/bin/env ruby
require 'socket'
require 'openssl'
module Foo
end
OpenSSL::SSL::SSLSocket.prepend(Foo)
# This line crashes with the prepend() but works without it
package {
import starling.core.Starling;
import starling.animation.Transitions;
import starling.animation.Tween;
public class Utils {
// This function accepts an originalX and originalY so that you can shake things that
// are on screen but not necessarily originally located at 0, 0 (compared to the original
// implementation which only ever moved things back to 0, 0)
public static function screenShake(drawable:Shakeable, shakeDuration:Number, intensity:Number, originalX:Number, originalY:Number):void {

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@stevedev
stevedev / fish
Created August 28, 2017 20:06
Fish tank generator for slack. Because.
#!/usr/bin/ruby
# some fish!
fish = %w{ fish fish2 fish3 fish4 fish5 fish6 fish7 }
# At least 3 lines
lines = rand(4) + 3
output = ""
@sathiyaseelan
sathiyaseelan / golang_setup.md
Last active April 1, 2024 18:51
Basics to setup a golang project repo in your local

Simple Guide to setup Golang in your Mac and clone a repo.

Setup Go and workspace

Type go in terminal, to verify the installation.

  • Create a Go workspace and set GO PATH