View build_systemd_sleep_selinux_module.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd "$(mktemp -dt)" | |
cat <<-EOF | tee systemd_sleep.te | |
module systemd_sleep 1.0; | |
require { | |
type systemd_sleep_t; | |
type systemd_unit_file_t; | |
type unlabeled_t; | |
type udev_var_run_t; | |
type init_var_lib_t; |
View linux_wifi_perf.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# most of the hacks taken from | |
# https://support.system76.com/articles/wireless/ | |
sudo vim /etc/nsswitch.conf | |
# look for the following line | |
# hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 | |
# If you find this file, replace it with the following line: | |
# hosts: files dns | |
sudo vim /etc/modprobe.d/iwlwifi.conf |
View backbone_partial_render.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Renders part of the view instead all of it. | |
* Useful in sutuations where view contains counter and input fields. | |
* Counter needs to be updated, while input state left intact. | |
* */ | |
Backbone.View.prototype.renderPartial = function(selector, data, template) { | |
template = template || this.template; | |
var self = this; | |
var $html = $('<div>' + template(data) + '</div>'); |
View svgrasterize.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#--------------------------------------------------------------- | |
# Creates png files from given svg files in a directory. | |
# Target png dimensions hardcoded (120px width, height auto). | |
# Note: you need to `npm install -g svgexport` first. | |
# | |
# Usage example: | |
# ./svgrasterize.sh . | |
#--------------------------------------------------------------- |
View Howto convert a PFX to a seperate .key & .crt file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/ | |
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]` | |
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file. | |
Now let’s extract the certificate: | |
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]` |
View get_selection_ccords.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSelectionCoords(win) { | |
win = win || window; | |
var doc = win.document; | |
var sel = doc.selection, range, rects, rect; | |
var x = 0, y = 0; | |
if (sel) { | |
if (sel.type != "Control") { | |
range = sel.createRange(); | |
range.collapse(true); | |
x = range.boundingLeft; |
View 51-android.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666" | |
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666" |
View loader.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.loading { | |
position: relative; | |
} | |
.loading:before { | |
content: ""; | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; |
View eps2svg.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=$(find $1 -maxdepth 1 -name '*.eps') | |
for file in $FILES | |
do | |
extension="${file##*.}" | |
filename="${file%.*}" | |
#echo $file | |
#echo $filename |
View thread_pool.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Execute function in process/thread pool with possibility to get return values | |
credits to http://stackoverflow.com/a/8533626 | |
""" | |
from multiprocessing.pool import ThreadPool as Pool | |
# for process-based pool use | |
# from multiprocessing import Pool | |
import time |
NewerOlder