Skip to content

Instantly share code, notes, and snippets.

@blessanm86
blessanm86 / german-driving-license.md
Last active February 7, 2024 15:51
Quick Ref Notes for German Driving License Test

This is unmaintained and was created for personal use. As I passed the exam I have no use to keep this up to date. Feel free to fork

What are the consequences for a person driving a motor vehicle under the influence of drugs (e.g. hashish, heroin, cocaine)?

[x] Confiscation of driving licence or driving ban
[x] Compulsory medical/psychological examination
[x] Fine and/or imprisonment

In which instances do you have to approach a pedestrian crossing with particular care?

@Ryanb58
Ryanb58 / install.md
Last active March 18, 2024 00:17
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@johntran
johntran / wineTax.js
Last active October 24, 2023 13:50
ES7 async/await with SOAP requests in NodeJS
import soap from 'soap';
import moment from 'moment';
const taxServiceUrl = 'http://hehexd.com/services/1.2/taxservice.asmx?WSDL'
export function generateJsonForTaxRate(json) {
const EffectiveDate = moment().toISOString();
const {
city: City,
state: State,
addressLineOne: Street1,
@dmeents
dmeents / redux-form-tut.js
Created August 6, 2016 20:40
The source code for the redux form tutorial on davidmeents.com
import React, { Component } from 'react';
import { Field, reduxForm } from 'redux-form';
import { connect } from 'react-redux';
import * as actions from '../../actions';
const form = reduxForm({
form: 'ReduxFormTutorial',
validate
});
@lopezjurip
lopezjurip / 00000000000000_enable_uuid.rb
Created July 19, 2016 17:28
Rails 5 w/ Postgres: Use UUID instead of a numeric ID as primary keys
# db/migrate/00000000000000_enable_uuid.rb
class EnableUuid < ActiveRecord::Migration[5.0]
def change
execute 'create extension "uuid-ossp"'
enable_extension 'uuid-ossp'
end
end
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@stephan-nordnes-eriksen
stephan-nordnes-eriksen / key-value-performance-test.md
Last active February 21, 2024 03:22
Performance testing different Key-Value stores in Ruby

For a project I am on I need to use a key-value store to converts file-paths to fixnum IDs. The dataset will typically be in the range of 100 000 to 1 000 000. These tests use 305 000 file paths to fixnum IDs.

The Different Key-Value stores tested are:

Daybreak: "Daybreak is a simple and very fast key value store for ruby" GDBM: GNU dbm. "a simple database engine for storing key-value pairs on disk." DBM: "The DBM class provides a wrapper to a Unix-style dbm or Database Manager library" PStore: "PStore implements a file based persistence mechanism based on a Hash. "

Out of these, all except Daybreak are in the Ruby standard library.

local function string(o)
return '"' .. tostring(o) .. '"'
end
local function recurse(o, indent)
if indent == nil then indent = '' end
local indent2 = indent .. ' '
if type(o) == 'table' then
local s = indent .. '{' .. '\n'
local first = true
@pithyless
pithyless / integer.rb
Created March 24, 2014 10:50
Ruby Integer::MAX and Integer::MIN
class Integer
N_BYTES = [42].pack('i').size
N_BITS = N_BYTES * 16
MAX = 2 ** (N_BITS - 2) - 1
MIN = -MAX - 1
end
p Integer::MAX #=> 4611686018427387903
p Integer::MAX.class #=> Fixnum
p (Integer::MAX + 1).class #=> Bignum
@nathancolgate
nathancolgate / mime_types.rb
Last active November 18, 2018 15:17 — forked from ream88/excel_template_handler.rb
Example demonstrating the use of writeexcel gem in rails 3.2
# config/initializers/mime_types.rb
Mime::Type.register "application/vnd.ms-excel", :xls