Skip to content

Instantly share code, notes, and snippets.

Ubuntu: add (.bashrc) \[\033[01;33m\] $(__git_ps1 "(%s)")\[\033[00m\]\$ for yellow (01;33) prompt
`export PS1="$PS1\[\033[01;33m\]$(__git_ps1 "(%s)")\[\033[00m\]$
(setq inhibit-startup-screen t)
(setq custom-file "~/.emacs.d/custom-settings.el")
(load custom-file t)
;; Packages
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
@isido
isido / simplestats-queries.sql
Last active October 25, 2016 14:29
DSpace-Simplestats queries
-- Select all parents
SELECT DISTINCT c.community_id id, c.name FROM community c, community2community r WHERE c.community_id = r.parent_comm_id;
-- Select all (first-level) children of parent X (here 53)
SELECT DISTINCT c.community_id id, c.name FROM community c, community2community r WHERE r.parent_comm_id = 53 AND c.community_id = r.child_comm_id;
-- Select all collections in community X (here 54)
SELECT DISTINCT c.collection_id id, c.name FROM collection c, community2collection r WHERE r.collection_id = c.collection_id AND r.community_id = 54;
-- Select all child communities, recursively from community X (here 53)
@isido
isido / pg_backup
Last active October 17, 2016 06:19
PostgreSQL backup script found from internet.
[email protected]
# run daily postgres backup
01 1 * * * postgres /usr/local/bin/pg_backup_rotated.sh -c /etc/pg_backup.config

Keybase proof

I hereby claim:

  • I am isido on github.
  • I am isido (https://keybase.io/isido) on keybase.
  • I have a public key whose fingerprint is 0CAA 34F6 444D F268 DB17 F1E2 2A72 AE8F 9D26 059B

To claim this, I am signing this object:

@isido
isido / myjulias.jl
Created June 20, 2016 11:39
Misc. Julia functions
# e element, m modulus
function print_multexp_table(e, m)
println("------------");
for i = 0:(m-1)
@printf "%d\t%d\n" i ((i * e) % m)
end
end
@isido
isido / dspace.sql
Created April 20, 2016 08:25
Select items with certain metadata set
select a.text_value "uef.solecris.id", b.text_value "dc.title"
from (
select resource_id, text_value
from metadatavalue
where metadata_field_id = (
select metadata_field_id
from metadatafieldregistry r, metadataschemaregistry s
where s.short_id = 'uef' and r.element = 'solecris'
and r.qualifier = 'id' and r.metadata_schema_id = s.metadata_schema_id)) a
@isido
isido / gist:6bd862616869d1b5b9ce
Last active December 17, 2015 12:47
Things to do with new OpenBSD installation
1. Set up package mirror:
export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/
(+ put it to ~/.profile)
@isido
isido / read_file.sml
Last active August 29, 2015 14:17
SML snippets
fun read_file in_stream =
let
fun loop ins =
case TextIO.inputLine ins of
SOME line => line :: loop ins
| NONE => []
in
loop in_stream before TextIO.closeIn in_stream
end
@isido
isido / gist:879812f0e92eae5185e1
Created July 7, 2014 09:13
Switch to JDK 7 on OSX
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)