Skip to content

Instantly share code, notes, and snippets.

View ddacunha's full-sized avatar

Daniel Da Cunha ddacunha

View GitHub Profile
@anildigital
anildigital / gist:4fae9b51f1d416504899
Created July 26, 2015 17:44
Docker desktop on OSX
# https://github.com/docker/docker/issues/8710
brew install socat
brew cask install xquartz
open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
# in another window
docker run -e DISPLAY=192.168.59.3:0 jess/geary
@emad-elsaid
emad-elsaid / code_converter.rb
Created April 20, 2014 13:05
Convert Ruby scripts to HTML and Markdown first i have to say that my scripts will be a little longer than ever, to be more verbose and less encrypted, so images associated with my posts will be cropped and linked to full post on Github, post will contain an HTML version and code file. this script will read ruby code and parse it and split it to…
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'pygmentize' # gem install pygmentize
require 'redcarpet' # gem install redcarpet
# consecutive lines of code
# should be highlighted using pygmentize
# and converter to markdown block simply
# using the markdown syntax for code
# used by github flavored markdown
@mathieulegrand
mathieulegrand / connect.rs
Last active March 10, 2018 19:57
simple connect to server:443 in Rust
// Rust 0.10-pre (Tue Mar 18, 2014)
// $ rustc -L rust-openssl/build/ -L rust-toml/lib doing.rs
// assuming https://github.com/sfackler/rust-openssl is cloned and compiled,
// and https://github.com/mneumann/rust-tom is cloned and compiled
#[feature(macro_rules)];
#[allow(deprecated_owned_vector)];
extern crate openssl;
extern crate serialize;
@cheeaun
cheeaun / rdrc2016.md
Last active June 13, 2018 08:39
RedDotRubyConf 2016 links & resources 😘
@siddhi
siddhi / pyconindia_dsl.py
Created September 16, 2011 06:33
Domain Specific Languages in Python - Pycon India - 17 Sep 2011
from pyparsing import *
# By default, PyParsing treats \n as whitespace and ignores it
# In our grammer, \n is significant, so tell PyParsing not to ignore it
ParserElement.setDefaultWhitespaceChars(" \t")
def parse(input_string):
def convert_prop_to_dict(tokens):
"""Convert a list of field property tokens to a dict"""
prop_dict = {}
@munificent
munificent / gist:9749671
Last active June 23, 2022 04:04
You appear to be creating a new IDE...
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs:
@FHeilmann
FHeilmann / fix_klipper_deprecation.md
Last active July 12, 2022 00:56
Fixing klipper config errors related to deprecation updates in late 2021

In late 2021, klipper removed some features that were deprecated over the course of 2020 and 2021. This document summarizes them briefly and shows how to fix them:

Removal of step_distance

step_distance describes the distance covered by a certain axis with 1 stepper (micro-)step. The downside of this parameter (and one of the reasons for its removal, is that if one were to change the microstepping of a stepper, the step_distance changes as well. Klipper therefore removed the step_distance parameter in favor of rotation_distance and full_steps_per_rotation. These two parameters are unaffected by microstepping, and can be easily determined by inspecting the used hardware.

Perform the following steps to convert your config:

  • comment out the old step_distance parameter
  • add three new parameters:
@cs278
cs278 / dovecot-maildir-compress.sh
Created December 17, 2011 15:52
Compresses email in maildir format
#!/bin/sh
# Find the mails you want to compress in a single maildir.
#
# Skip files that don't have ,S=<size> in the filename.
#
# Compress the mails to tmp/
#
# Update the compressed files' mtimes to be the same as they were in the original files (e.g. touch command)
#
@denvazh
denvazh / README.md
Last active March 17, 2023 16:38
Scheduled update for homebrew

Scheduled updates for homebrew

This two launchdaemon scripts provide scheduled updates and upgrade for homebrew packages.

It will run in the following way:

  • brew update every day at 12:10
  • brew upgrade every day at 12:20

How to install

@mbuchetics
mbuchetics / json.swift
Created June 30, 2017 09:28 — forked from reckenrode/json.swift
Decoding arbitrary JSON with the new Decoder in Swift 4
enum JSON: Decodable {
case bool(Bool)
case double(Double)
case string(String)
indirect case array([JSON])
indirect case dictionary([String: JSON])
init(from decoder: Decoder) throws {
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) {
self = JSON(from: container)