Skip to content

Instantly share code, notes, and snippets.

View fipar's full-sized avatar

Fernando Ipar fipar

View GitHub Profile
@Sheeri
Sheeri / php-cli.spec
Last active January 24, 2022 21:55
recompile php_cli using libmysqlclient, for use with LDAP authentication via pam.so
# IUS spec file for php70u, forked from
#
# Fedora spec file for php
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#
# API/ABI check
@brendangregg
brendangregg / dockerpsns.sh
Last active August 23, 2023 10:11
docker ps --namespaces
#!/bin/bash
#
# dockerpsns - proof of concept for a "docker ps --namespaces".
#
# USAGE: ./dockerpsns.sh
#
# This lists containers, their init PIDs, and namespace IDs. If container
# namespaces equal the host namespace, they are colored red (this can be
# disabled by setting color=0 below).
#
@fernandoaleman
fernandoaleman / gist:5083680
Last active October 17, 2023 12:02
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.

(defun org-random-entry (&optional arg) “Select and goto a random todo item from the global agenda” (interactive “P”) (if org-agenda-overriding-arguments (setq arg org-agenda-overriding-arguments)) (if (and (stringp arg) (not (string-match “\S-” arg))) (setq arg nil)) (let* ((today (org-today)) (date (calendar-gregorian-from-absolute today)) (kwds org-todo-keywords-for-agenda) (lucky-entry nil)

@stephenturner
stephenturner / arrange_ggplot2.R
Created September 14, 2012 21:30
Arrange ggplot2 plots
## Function for arranging ggplots. use png(); arrange(p1, p2, ncol=1); dev.off() to save.
require(grid)
vp.layout <- function(x, y) viewport(layout.pos.row=x, layout.pos.col=y)
arrange_ggplot2 <- function(..., nrow=NULL, ncol=NULL, as.table=FALSE) {
dots <- list(...)
n <- length(dots)
if(is.null(nrow) & is.null(ncol)) { nrow = floor(n/2) ; ncol = ceiling(n/nrow)}
if(is.null(nrow)) { nrow = ceiling(n/ncol)}
if(is.null(ncol)) { ncol = ceiling(n/nrow)}
## NOTE see n2mfrow in grDevices for possible alternative
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 23, 2024 19:14
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@jordelver
jordelver / gist:3139365
Created July 18, 2012 22:29
How to write an image file to an SD card under Mac OS X (for Raspberry Pi)

Find the SD card device

In this case, the SD card is /dev/disk4. DO NOT get this wrong or you may destroy all the data on the wrong disk/card/drive.

diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *160.0 GB   disk0

1: EFI 209.7 MB disk0s1

@bds
bds / SparkLines in R
Created December 30, 2010 14:27
Sample sparkline plot using ggplot
library(ggplot2)
sparkLinePlot <- function(df, plot.file) {
highest <- subset(df, outcomes == max(outcomes))
lowest <- subset(df, outcomes == min(outcomes))
p <- ggplot(df, aes(x=date, y=outcomes)) +
geom_line() +
opts(panel.border = theme_rect(linetype = 0),