Skip to content

Instantly share code, notes, and snippets.

tarnagas

Block or report user

Report or block tarnagas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tarnagas
tarnagas / rasp-backup
Last active Jun 12, 2019
Save raspberry state as a compressed img file
View rasp-backup
#!/usr/bin/env sh
# Sample of use:
#
# rasp-backup /dev/sdc
set -eu
IMG_FILE=rasp.$(date +%Y%m%d.%s).img.gz
GZIP_BIN="$(which pigz)" # tries for multithread gzip
test -z "${GZIP_BIN}" && {
View appifier.js
'use strict'
/**
* Sample of use
*
* ```js
* import { path as MediasPath } from './vue/medias/forms'
* import { content_type as WorksContentType } from './vue/works/forms'
* appify({
* components: {
@tarnagas
tarnagas / import.sh
Last active Feb 20, 2019
Import dump generated by mysqlpump
View import.sh
#!/usr/bin/env sh
# Sample of use:
#
# ```sh
# sh import.sh backuped_database.sql
# ```
#
# @see https://hub.docker.com/r/mysql/mysql-server/
# @see https://dev.mysql.com/doc/refman/8.0/en/mysqlpump.html
@tarnagas
tarnagas / .screenrc
Created Feb 15, 2019
Minimal config for screen (.screenrc)
View .screenrc
# Global configration
# --------------------------------------------------------------------
startup_message off
autodetach on
nonblock on
altscreen on
# define a bigger scrollback, default is 100 lines
defscrollback 1000
term screen-256color
View hello.kt
/**
* kotlinc/bin/kotlinc hello.kt -include-runtime -d hello.jar
* java -jar hello.jar
*
* https://github.com/Zenika/docker-kotlin/blob/master/1.3/jdk12/Dockerfile
*/
fun main(args: Array<String>) {
println("Hello, %s!".format(args[0]))
}
@tarnagas
tarnagas / max.sql
Created Nov 15, 2018
SQL MAX (LEFT JOIN alternative)
View max.sql
SELECT * FROM events
LEFT JOIN events as e2 ON e2.tag_id = events.tag_id
AND e2.change_dt > events.change_dt
WHERE e2.change_dt IS NULL
View gist:0466c4aa76d08f29b7c050f443ab50da
<?php
$locale = 'nl_NL';
Mage::app()->getLocale()->setLocaleCode($locale);
Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
//http://www.kennydeckers.com/programatically-set-locale-language-magento/
?>
@tarnagas
tarnagas / sample-liquid-yaml.rb
Created Aug 16, 2017
Sample use of liquid (gem) to generate YAML
View sample-liquid-yaml.rb
#!/usr/bin/env ruby
require 'liquid'
template = <<-HEREDOC
data:
{%- for item in plops %}
- {{ item }}
{%- endfor %}
host: "sample.local"
@tarnagas
tarnagas / sample-count-grouped.sql
Created Aug 16, 2017
sample count grouped sql
View sample-count-grouped.sql
SELECT *, (
case when sku = 'W556B' then 1 else 0 end +
case when product_type = 'Tapis' then 1 else 0 end
) as cnt from etl_raw_import_art
WHERE (sku = 'W556B' or product_type = 'Tapis')
order by
case when sku = 'W556B' then 1 else 0 end +
case when product_type = 'Tapis' then 1 else 0 end
DESC
You can’t perform that action at this time.