Skip to content

Instantly share code, notes, and snippets.

Avatar

Christian Aust datenimperator

View GitHub Profile
View test1.sh
$ curl -I "https://static.licdn.com/scds/concat/common/css?h=cfsam81o5sp3cxb7m0hs933c4-ayz9yfto6yuvfbnjryz2uhv2r-154kxlhs4z8rrtcvqfbage7t-7z4tik36jao0xe22l10ei9fcy-5f340g5yhr0lmw2pgno437wcy-58a70hzll4g8kku1jqu5hcq77-6lg80obqw1a6e31g5xzz9modk-24zwqzg0twslliln0crwh71os-ajta1vvnnddstrmknoo01iksx-btxvz0skzcibopne8uegno3ah-e6ngnxj94o59jnla2nbeg59xg-aqatrh64t5i533h03ger8nmga-1qropirar95tlkfqbsa60th2t-974h8s1tcqf8tu9jmk1ya9u2u-1v46v9xbj08je7u9ip252ln8n-3kfbjgrixoegzbffwmpb09dva-20qsp69recmq07kx7d3qe31zw-2fwpxhxm2x0u28ijz7ypc2afv-dh9s2pgf6ghcuifobl7cvitf9&fc=1"
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verificatio
@datenimperator
datenimperator / issues.rb
Created May 6, 2014
Display active, assigned tickets from Gitlab using Ruby
View issues.rb
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
GITLAB='http://your.gitlabhost.com'
TOKEN='security_token'
USERNAME='your_username'
issues = JSON.load(open("#{GITLAB}/api/v3/issues?private_token=#{TOKEN}"))
@datenimperator
datenimperator / model.rb
Created Apr 28, 2014
Unique numbering DSL
View model.rb
class Model < ActiveRecord::Base
# setzt :invoice_id Attribut im before_create
has_unique :invoice_id,
scoped_by: lambda{ Time.new.year },
formatter: lambda{ |scope, value| sprintf("R-%04d-%04d", scope, value) }
end
View keybase.md

Keybase proof

I hereby claim:

  • I am datenimperator on github.
  • I am datenimperator (https://keybase.io/datenimperator) on keybase.
  • I have a public key ASDPliMCnFOzTNN1WeO8hME-LOOxQXu-fhKGGF2YJe1vcQo

To claim this, I am signing this object:

@datenimperator
datenimperator / foundation_grids.html
Created Jan 12, 2014
Comparison of Foundation grid elements from version 2-5
View foundation_grids.html
<!-- Foundation 2.x, http://foundation.zurb.com/docs/v/2.2.1/grid.php -->
<div class="container">
<div class="row">
<div class="eight columns">
Eight columns
</div>
<div class="four columns">
Four columns
</div>
</div>
@datenimperator
datenimperator / isin.rb
Created Dec 3, 2013
An International Securities Identification Number (ISIN) uniquely identifies a security. Its structure is defined in ISO 6166. This Ruby code implements a validity check for a given ISIN string.
View isin.rb
class Isin
COUNTRY_CODES = %w{AF AX AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BQ BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CD CK CR CI HR CU CW CY CZ DK DJ DM DO EC EG SV GQ ER EE ET FK FO FJ FI FR GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GG GN GW GY HT HM VA HN HK HU IS IN ID IR IQ IE IM IL IT JM JP JE JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN ME MS MA MZ MM NA NR NP NL NC NZ NI NE NG NU NF MP NO OM PK PW PS PA PG PY PE PH PN PL PT PR QA RE RO RU RW BL SH KN LC MF PM VC WS SM ST SA SN RS SC SL SG SX SK SI SB SO ZA GS SS ES LK SD SR SJ SZ SE CH SY TW TJ TZ TH TL TG TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VG VI WF EH YE ZM ZW}
def initialize(v)
@content = v.upcase
end
def to_s
@content
end
@datenimperator
datenimperator / sqlite.rb
Created Nov 22, 2013
Speed up your Rails sqlite database for large dataset. This should be a Rails initializer, goes into config/initializers.
View sqlite.rb
if ::ActiveRecord::Base.connection_config[:adapter] == 'sqlite3'
if c = ::ActiveRecord::Base.connection
# see http://www.sqlite.org/pragma.html for details
# Page size of the database. The page size must be a power of two between 512 and 65536 inclusive
c.execute 'PRAGMA main.page_size=4096;'
# Suggested maximum number of database disk pages that SQLite will hold in memory at once per open database file
c.execute 'PRAGMA main.cache_size=10000;'
View GitHub2++.css
@media print {
h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p {
page-break-before: avoid;
}
}
@datenimperator
datenimperator / i18n.rb
Created Jul 19, 2013
Did you ever wonder what your Rails i18n is doing? Why your translation isn't found? Add this initializer to log every i18n translation as it happens.
View i18n.rb
I18n::Backend::Base.class_eval do
def translate_with_logging(locale, key, options = {})
Rails.logger.debug " i18n: #{locale} #{key} #{options.inspect}"
translate_without_logging(locale, key, options)
end
alias_method_chain :translate, :logging
end
@datenimperator
datenimperator / dkms.conf
Created May 18, 2013
dkms.conf is in /usr/src/r8168-8.035.00
View dkms.conf
PACKAGE_NAME=r8168
PACKAGE_VERSION=8.035.00
MAKE[0]="'make' modules"
BUILT_MODULE_NAME[0]=r8168
BUILT_MODULE_LOCATION[0]="src"
DEST_MODULE_LOCATION[0]="/kernel/updates/dkms"
AUTOINSTALL="YES"
You can’t perform that action at this time.