Skip to content

Instantly share code, notes, and snippets.

View iuridiniz's full-sized avatar

Iuri Diniz iuridiniz

View GitHub Profile
@iuridiniz
iuridiniz / couchdb.local
Last active April 11, 2018 12:29
script to start local databases instances under /tmp (ubuntu)
#!/bin/sh
##################################
# CONFIG
COUCHDB_SERVER=${COUCHDB_SERVER:=$( which couchdb )}
# if couchdb was not found under PATH, try a search on ~/.local/opt and /opt
COUCHDB_SERVER=${COUCHDB_SERVER:=$( find ~/.local/opt /opt -name 'couchdb' -type f -executable -print -quit )}
COUCHDB_BASEDIR=${COUCHDB_BASEDIR:="${COUCHDB_SERVER%/*}/.."}
COUCHDB_HOME=${COUCHDB_HOME:="/tmp/couchdb"}
COUCHDB_DB_DATA=${COUCHDB_DB_DATA:="${COUCHDB_HOME}/data"}
@spinxz
spinxz / vncserver@:1.service
Last active January 25, 2024 01:42
systemd service file for running a vncserver (e.g. tightvncserver)
# Vncserver service file for Debian or Ubuntu with systemd
#
# Install vncserver and tools
# e.g. apt-get install tightvncserver autocutsel gksu
#
# 1. Copy this file to /etc/systemd/system/vncserver@:1.service
# 2. Edit User=
# e.g "User=paul"
# 3. Edit the vncserver parameters appropriately in the ExecStart= line!
# e.g. the -localhost option only allows connections from localhost (or via ssh tunnels)
import java.io.*;
import java.util.*;
import java.security.cert.CertificateException;
import java.security.KeyStoreException;
import java.security.cert.X509Certificate;
import java.security.KeyStore;
import java.security.Provider;
import java.security.Security;
public class SmartCard {
@woods
woods / gen-key-script
Last active March 12, 2024 12:00
Creating gpg keys non-interactively
Key-Type: 1
Key-Length: 2048
Subkey-Type: 1
Subkey-Length: 2048
Name-Real: Root Superuser
Name-Email: root@handbook.westarete.com
Expire-Date: 0
<?php
/*
Made by Kudusch (blog.kudusch.de, kudusch.de, @Kudusch)
---------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
@sbimikesmullin
sbimikesmullin / mdadm_undo.sh
Created December 3, 2013 22:01
mdadm: undo a software raid
sudo fdisk -l # Find out your arrays (md0, md1, etc..)
sudo mdadm --detail /dev/md0 # Query your arrays to find out what disks are contained using
sudo umount /backup # unmount all partitions on that drive
sudo mdadm --stop /dev/md0 # Shut down the array
sudo mdadm --zero-superblock /dev/xvdc /dev/xvdd /dev/xvde # zero the superblock FOR EACH drive
# The Script
```sh
git log v2.1.0...v2.1.1 --pretty=format:'<li> <a href="http://github.com/jerel/<project>/commit/%H">view commit &bull;</a> %s</li> ' --reverse | grep "#changelog"
```
# A git alias for the command:
@crosbymichael
crosbymichael / Dockerfile
Last active January 8, 2022 13:47
Docker with supervisor
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y openssh-server supervisor
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
RUN mkdir -p /var/run/sshd
@willurd
willurd / web-servers.md
Last active June 3, 2024 01:13
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 1, 2024 14:11
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%'