This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Install as a Nautilus script: | |
# perl export-400px.pl --install | |
# | |
# Install dependencies: | |
# sudo aptitude install libimage-exiftool-perl libpath-tiny-perl imagemagick zenity | |
# | |
# Author: Olivier Mengué | |
# Created: Sun Feb 28 20:30:55 2016 +0100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main_test | |
import ( | |
"encoding/json" | |
"reflect" | |
) | |
func checkJSONRoundtrip(t *testing.T, value interface{}, expectedJSON json.RawMessage) bool { | |
b, err := json.Marshal(value) | |
if err != nil { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
version: "1.0.0" | |
title: "Swagger Petstore" | |
license: | |
name: "Apache 2.0" | |
url: "http://www.apache.org/licenses/LICENSE-2.0.html" | |
host: "petstore.swagger.io" | |
basePath: "/v2" | |
tags: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/jq -cf | |
# This script transforms a JSON input containing a single array into the "JSON Lines" format (http://jsonlines.org) | |
# See https://stackoverflow.com/questions/42178636/how-to-use-jq-to-output-jsonl-one-independent-json-object-per-line | |
# | |
# Install: | |
# - save this file as "jsonl" | |
# - install jq (https://stedolan.github.io/jq/) | |
# - chmod u+rx jsonl | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package structintmap | |
import "reflect" | |
func StructIntMap(value interface{}) map[string]int { | |
m := make(map[string]int) | |
structIntMap(reflect.ValueOf(value), m, "") | |
return m | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///usr/bin/cc -o "${0%.c}" "$0" && exec "./${0%.c}" | |
// Author: Olivier Mengué | |
// Install: chmod u+x hello.c | |
#include <stdio.h> | |
int main() | |
{ | |
puts("hello world"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From /usr/include/signal.h | |
cc -E -dM /usr/include/signal.h | sed -nE 's/^#define (SIG[A-Z0-9]+ +[1-9][0-9]{0,1})$/\1/p' | sort -n -k 2 | |
# Or | |
kill -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "reflect" | |
func StructIntMap(value interface{}) map[string]int { | |
m := make(map[string]int) | |
structIntMap(reflect.ValueOf(value), m, "") | |
return m | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT('ALTER TABLE `',TABLE_SCHEMA,'`.`', TABLE_NAME, '` ', GROUP_CONCAT(' MODIFY COLUMN "', COLUMN_NAME, '` TIMESTAMP ',IF(IS_NULLABLE = 'NO','NOT',''),' NULL'),';') | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_SCHEMA = DATABASE() | |
AND DATA_TYPE = 'DATETIME' | |
GROUP BY TABLE_SCHEMA, TABLE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://play.golang.org/p/iWDGHj_-X_ | |
This programs generates 32 random bytes formatted à la "hexdump -C". | |
It does it in just 2 lines of code using the power of the standard library | |
and a trick to convert a func Read([]byte) (int, error) into an io.Reader. | |
Inspiration: see HandlerFunc in net/http |