Skip to content

Instantly share code, notes, and snippets.

Avatar
✔️
Verified

Garrett T film42

✔️
Verified
View GitHub Profile
@eduncan911
eduncan911 / go-build-all
Last active Dec 16, 2020
Go Cross-Compile Script
View go-build-all
#!/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 Jan 15, 2021
Create an SslSocketFactory using PEM encrypted certificate files
View SslUtil.java
/**
* 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;
@l8nite
l8nite / gist:18e1aa073d4c758bf440
Created Nov 20, 2014
Quick and dirty way to exclude files from a gemspec
View gist:18e1aa073d4c758bf440
git_tracked_files = `git ls-files -z`.split("\x0")
gem_ignored_files = `git ls-files -i -X .gemignore -z`.split("\x0")
spec.files = git_tracked_files - gem_ignored_files
@noprompt
noprompt / slurp.clj
Created Feb 19, 2014
How to use slurp from ClojureScript
View slurp.clj
(ns foo.core
(:refer-clojure :exclude [slurp]))
(defmacro slurp [file]
(clojure.core/slurp file))
;; In CLJS
(ns bar.core
(:require [foo.core :include-macros true :refer [slurp]]))
View Try.scala
private def getForecast:Try[JsValue] = {
val ts = date.getTime / 1000
val u = {
if (date == new Date()) new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon?units=$units")
else new URL(s"https://api.forecast.io/forecast/$apiKey/$lat,$lon,$ts?units=$units")
}
val s = new Scanner(u.openStream(), "UTF-8")
Try{s.useDelimiter("\\A").next().asJson}
}
@Kimundi
Kimundi / java_rust_generic.md
Last active Jan 3, 2021
A light comparison between Rust and Java generics and type system features.
View java_rust_generic.md

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

@danneu
danneu / golang-vs-clojure-async.md
Last active Jan 13, 2021
Google I/O 2012 - Go Concurrency Patterns ported to Clojure Video: http://www.youtube.com/watch?v=f6kdp27TYZs
View golang-vs-clojure-async.md
@philipbjorge
philipbjorge / Grammar__Grammar.py
Last active Dec 15, 2015
Empty Set Literal Notation for Python 2.7 [BUGFIX] Replaced minus sign with @ symbol. With the minus sign, Python couldn't handle any set notation that started with a negative (e.g. {-3} would fail).
View Grammar__Grammar.py
# Grammar for Python
# Note: Changing the grammar specified in this file will most likely
# require corresponding changes in the parser module
# (../Modules/parsermodule.c). If you can't make the changes to
# that module yourself, please co-ordinate the required changes
# with someone who can; ask around on python-dev for help. Fred
# Drake <fdrake@acm.org> will probably be listening there.
# NOTE WELL: You should also follow all the steps listed in PEP 306,
View gist:3217582
;; 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])))
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
You can’t perform that action at this time.