Skip to content

Instantly share code, notes, and snippets.

View fgolemo's full-sized avatar
:shipit:

Florian Golemo fgolemo

:shipit:
View GitHub Profile
@silent1mezzo
silent1mezzo / 0fixup.md
Created January 24, 2012 15:12 — forked from SethRobertson/index.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

@jterrace
jterrace / xvfb
Created June 11, 2012 18:46
xvfb init script for Ubuntu
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@rdb
rdb / js_linux.py
Last active April 8, 2024 10:12
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://discourse.panda3d.org/t/game-controllers-on-linux-without-pygame/14128
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};
@briandk
briandk / install-texlive-without-docs.py
Created July 20, 2016 20:55
Instal a full latex texlive on Ubuntu Xenial without any of the docs
import subprocess
get_line_by_line_texlive_dependencies = subprocess.run(
[
"apt-cache",
"depends",
"texlive-full"
],
universal_newlines=True,
stdout=subprocess.PIPE
@tekemperor
tekemperor / rpi3-bt-keyboard.txt
Created July 22, 2016 01:46
Connect Apple Wireless Keyboard to Raspberry Pi 3 in Raspbian
sudo service bluetooth status # Verify bluetooth is active.
sudo bluetoothctl # Lauch bluetooth subshell.
agent on # [No idea what this does.]
default-agent # [No idea what this does.]
scan on # Displays a list of available devices.
pair XX:XX:XX:XX:XX:XX # This prepares a potential connection, the X's represent your device ID
# A "PIN code" will be displayed, type it on the keyboard and press "enter".
trust XX:XX:XX:XX:XX:XX # Adds device to trusted devices, this survives reboot.
connect XX:XX:XX:XX:XX:XX # Connect to the device now.
exit # Return to previous shell.

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to ExpressVPN.

This is adapted from SuperJamie's gist.

Requirements

I used a Raspberry Pi 3 - seems like the extra speed may be useful for running VPN.

@cyberang3l
cyberang3l / How to setup VirtualGL and TurboVNC on Ubuntu.md
Last active March 23, 2024 05:52
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding
@chauhan-utk
chauhan-utk / file.md
Created March 10, 2018 13:53
PyTorch replace pretrained model layers

This code snippet shows how we can change a layer in a pretrained model. In the following code, we change all the ReLU activation functions with SELU in a resnet18 model.

import torch
from torchvision import model

resnet18 = model.resnet18(pretrained=True)

def funct(list_mods):
@jeasinema
jeasinema / weight_init.py
Last active May 25, 2023 09:32
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''