Skip to content

Instantly share code, notes, and snippets.

View film42's full-sized avatar
✔️
Verified

Garrett Thornburg film42

✔️
Verified
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 25, 2024 06:23
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@eduncan911
eduncan911 / go-build-all
Last active April 11, 2024 07:14
Go Cross-Compile Script
#!/bin/bash
#
# GoLang cross-compile snippet for Go 1.6+ based loosely on Dave Chaney's cross-compile script:
# http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
#
# To use:
#
# $ cd ~/path-to/my-awesome-project
# $ go-build-all
#
@rohanag12
rohanag12 / SslUtil.java
Last active April 5, 2024 16:28
Create an SslSocketFactory using PEM encrypted certificate files
/**
* Utility class to read encrypted PEM files and generate a
* SSL Socket Factory based on the provided certificates.
* The original code is by Sharon Asher (link below). I have modified
* it to use a newer version of the BouncyCastle Library (v1.52)
*
* Reference - https://gist.github.com/sharonbn/4104301"
*/
import org.bouncycastle.cert.X509CertificateHolder;
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@Kimundi
Kimundi / java_rust_generic.md
Last active March 20, 2024 06:02
A light comparison between Rust and Java generics and type system features.

Introduction

If you are familiar with Java's generics, and are coming to Rust, you might be lead to assume that its generics are working the same way.

However, due to the different type systems, and different implementation details, there are quite a few differences between generic code in both languages.

This document tries to give a short summary about those differences:

Core functionality

Java

@camertron
camertron / measure.rb
Created June 15, 2012 22:48
Measure the memory taken by a Ruby object (by Robert Klemme)
#!/bin/env ruby
# lazy hack from Robert Klemme
module Memory
# sizes are guessed, I was too lazy to look
# them up and then they are also platform
# dependent
REF_SIZE = 4 # ?
OBJ_OVERHEAD = 4 # ?
@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
@danneu
danneu / golang-vs-clojure-async.md
Last active November 6, 2023 04:09
Google I/O 2012 - Go Concurrency Patterns ported to Clojure Video: http://www.youtube.com/watch?v=f6kdp27TYZs
@mblondel
mblondel / lda_gibbs.py
Last active October 9, 2023 11:31
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""