Skip to content

Instantly share code, notes, and snippets.

View pet1330's full-sized avatar

Peter Lightbody pet1330

View GitHub Profile
@pet1330
pet1330 / LICENSE
Created December 21, 2021 08:27 — forked from shaneutt/LICENSE
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@pet1330
pet1330 / mount_qcow2.md
Created August 16, 2021 12:07 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@pet1330
pet1330 / MainApplication.py
Created June 16, 2021 16:21 — forked from peace098beat/MainApplication.py
[PyQt] Drag and Drop files
class MainWidget(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWidget, self).__init__(parent)
self.setWindowTitle("FiFiFactory App")
self.resize(720,480)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.accept()
@pet1330
pet1330 / README.md
Created September 7, 2020 10:38 — forked from marc-hanheide/README.md
Guacamole VNC setup

Using virtual VNC Xserver over guacamole

Installation

  1. Install sudo apt-get install xfce4-session xfce4-goodies xrdp tigervnc-standalone-server
  2. The files /etc/xrdp/sesman.ini and /etc/xrdp/xrdp.ini may have to edited as in this gist, but it may work also with default configs
  3. For reconnections (in guacamole) to existing session to work, the resolution in guacamole for the connection should be fixed (e.g. to 1280x900 in the connection settings)
  4. Each user who wants to use it, should have the files ~/.xsession and ~/.vnc/xstartup with the defaults in this gist in their home directory

Without Guacamole

@pet1330
pet1330 / dbus-config.sh
Created August 27, 2020 14:22 — forked from marc-hanheide/dbus-config.sh
connect to Dbus (in gnome session) via SSH
# source this to set the dbus env in a gnome session
export DISPLAY=:0
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
# You may now configure things in gsettings, e.g. run vino:
gsettings reset org.gnome.Vino network-interface
gsettings set org.gnome.Vino enabled true
gsettings set org.gnome.Vino prompt-enabled false
@pet1330
pet1330 / mysql-docker.sh
Created March 15, 2019 09:32 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@pet1330
pet1330 / tinker_helper.php
Created February 1, 2019 08:34 — forked from calebporzio/tinker_helper.php
A quick, memorable way to initiate an "artisan tinker" session and play with variables.
<?php
function tinker(...$args) {
// Because there is no way of knowing what variable names
// the caller of this function used with the php run-time,
// we have to get clever. My solution is to peek at the
// stack trace, open up the file that called "tinker()"
// and parse out any variable names, so I can load
// them in the tinker shell and preserve their names.
@pet1330
pet1330 / TimeIt.py
Last active January 31, 2020 13:41
Timing Decorator
#!/usr/bin/python
def timeit(method):
import time
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
@pet1330
pet1330 / RosBagIt.py
Last active November 15, 2018 12:24
RosBag Decorator
#!/usr/bin/python
def rosbagit(method):
import subprocess
import roslib.packages
def cachable(method):
def cache_call(*args, **kw):
try:
return method.__globals__[method]
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@point-rpi
@xset s off
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser/Default/Preferences
@chromium-browser --noerrdialogs --disable-infobars --kiosk http://[YOUR_URL] --incognito
#@xscreensaver -no-splash@