Skip to content

Instantly share code, notes, and snippets.

View josepsmartinez's full-sized avatar

José Pedro Silveira Martinez josepsmartinez

View GitHub Profile
@wzpan
wzpan / timestamp.py
Created August 20, 2013 12:07
Python - timestamp
import datetime
# 2012-12-15 10:14:51.898000
print datetime.datetime.utcnow()
# The now differs from utcnow as expected
# otherwise they work the same way:
# 2012-12-15 11:15:09.205000
print datetime.datetime.now()
@versedi
versedi / kill-ssh-agents.bat
Created August 30, 2015 10:57
Kill all ssh-agents Windows
taskkill /F /IM ssh-agent.exe /T
@xcsrz
xcsrz / center_text_on_image.py
Created March 8, 2017 00:17
Center text on an image with Python and OpenCV. Had to come up with it myself as no one was spelling this out anywhere (or google couldn't find it)
#!/usr/bin/env python
import numpy as np
import cv2
from time import sleep
# create blank image - y, x
img = np.zeros((600, 1000, 3), np.uint8)
# setup text
@Brainiarc7
Brainiarc7 / xclip-copy-to-clipboard.md
Created April 26, 2017 17:53
Using xclip to copy terminal content to the clip board on Linux

Using xclip to copy terminal content to the clip board:

Say you want to pipe shell output to your clipboard on Linux. How would you do it? First, choose the clipboard destination, either the Mouse clip or the system clipboard.

For the mouse clipboard, pipe straight to xclip:

echo 123 | xclip

For the system clip board, pipe to xclip and select clip directly:

@ropnop
ropnop / startTerminator.vbs
Created September 29, 2017 00:02
VBS Script to Launch Terminator through WSL
args = "-c" & " -l " & """DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "bash", args, "", "open", 0
@PingjunChen
PingjunChen / convert_svs_img.py
Last active December 13, 2023 16:39
Convert SVS file to TIFF image
# -*- coding: utf-8 -*-
__author__ = "Pingjun Chen"
__email__ = "[email protected]"
import os, sys, pdb
import numpy as np
from scipy import misc
import matplotlib.pyplot as plt
from skimage import io
import openslide
@nistath
nistath / terminator.vbs
Last active February 19, 2023 22:15 — forked from ropnop/startTerminator.vbs
Script to start terminator on WSL from CMD or PowerShell
' Usage: terminator[.vbs] [path to starting directory]
' contents enclosed in square brackets optional
args = "-c" & " -l " & """DISPLAY=:0 terminator"""
' If there's a single argument, interpret it as the starting directory
If WScript.Arguments.Count = 1 Then
dir = WScript.Arguments(0)
Else
dir = ""
@GregRos
GregRos / startTerminator.vbs
Created April 27, 2019 00:20 — forked from ropnop/startTerminator.vbs
VBS Script to Launch Terminator through WSL
' terminator.vbs
myCd = "~"
If WScript.Arguments.Length > 0 Then
myCd = "'$(wslpath -u '" & WScript.Arguments(0) & "')'"
End If
args = "bash" & " -c ""cd " & myCd & "; DISPLAY=:0 terminator"""
WScript.CreateObject("Shell.Application").ShellExecute "C:\Windows\System32\wsl.exe", args, "", "open", 0
@josepsmartinez
josepsmartinez / SCRIPTPATH.sh
Last active March 21, 2022 13:27
Safe practice for attributing a script's directory UNIX path to a shell variable [Reference: https://stackoverflow.com/posts/4774063/revisions (2020/12/27)]
#!/bin/bash
SCRIPTPATH=$( cd $(dirname $0) >/dev/null 2>&1 ; pwd -P )
@josepsmartinez
josepsmartinez / ssh-set-permissions.sh
Last active October 3, 2021 15:49
ssh permissions
#!/bin/bash
# Configs
chmod 700 $HOME/.ssh
chmod 644 $HOME/.ssh/authorized_keys
chmod 644 $HOME/.ssh/known_hosts
chmod 644 $HOME/.ssh/config
# Keys
chmod 600 $HOME/.ssh/id_rsa