Skip to content

Instantly share code, notes, and snippets.

Pof Magicfingers PofMagicfingers

View GitHub Profile
View modman2gitignore.sh
#!/bin/bash
{ echo -e "\n# $(basename "$PWD")\n" ; sed -e 's/#.*$//' -e '/^$/d' modman | awk '{ print $2 }' } # >> ../../htdocs/.gitignore
@PofMagicfingers
PofMagicfingers / episode.rb
Created Jun 30, 2019
Season, episode and episode type inferred from title
View episode.rb
def infer_type_season_and_episode!
# try to detect episode number
tome_chapter_matcher = /(?>\bT(?>ome)?[\s\.]*(?<tome>[0-9]+)\b)?[\s\.]*\bCh(?>apitre|apter)?[\s\.]*(?<chapter>[0-9]+)\b/i
season_episode_matcher = /\b(S(?>eason|aison)?[\s\.]*(?<season>[0-9]+)[\s.]*)?(E|É)(?>pisode|p)?[\s\.]*(?<episode>[0-9]+)\b/i
simple_episode_matcher = /(?>#{::Regexp.escape(self.feed.try(:title))}\s*\#?|\#\s*|°\s*|(É|E)(?>pisode|p)[\s\.]*)(?<episode>[0-9]+)\b(?>$|\.?\s+|\:)/i
_tome = _chapter = _season = _episode = 0
tome_chapter_match = tome_chapter_matcher.match(self.title)
if tome_chapter_match
@PofMagicfingers
PofMagicfingers / 00-usb-keyboard.rules
Last active Mar 6, 2019
Keyboard layout auto change with udev
View 00-usb-keyboard.rules
ATTRS{idVendor}=="060b", ATTRS{idProduct}=="5252", OWNER="pof"
ACTION=="add", RUN+="/usr/local/bin/usb-keyboard-udev in"
ACTION=="remove", RUN+="/usr/local/bin/usb-keyboard-udev out"
View Keybase
### Keybase proof
I hereby claim:
* I am pofmagicfingers on github.
* I am pofmagicfingers (https://keybase.io/pofmagicfingers) on keybase.
* I have a public key ASAJuRDd9LX_Qj1QlwHJT90fBHf0tpHiYfgq0Herkby4oAo
To claim this, I am signing this object:
@PofMagicfingers
PofMagicfingers / redmine.sh
Last active Oct 1, 2018
shortcuts to Redmine with rofi
View redmine.sh
#!/bin/bash
config_file=$HOME/.config/redmine
if [ ! -f $config_file ]; then
cat << Usage
Please add your REDMINE_API_KEY and REDMINE_URL
into a file at ~/.config/redmine
REDMINE_API_KEY="apikey"
@PofMagicfingers
PofMagicfingers / server.js
Created Sep 17, 2018
Really simple and naive nodejs args parsing
View server.js
const parseArgs = (args, parsers) =>
Object.assign(
{},
...parsers.map(parser => {
const parsed = Object.assign(
{},
...args.map(arg => {
const parsed = arg.match(parser);
return (parsed && parsed.groups) || {};
})
View ohno.html
<script type="text/javascript">
jQuery(window).load(function () {
var size = 1;
var button = 1;
var button_class = "gallery-header-center-right-links-current";
var normal_size_class = "gallery-content-center-normal";
var full_size_class = "gallery-content-center-full";
var $container = jQuery('#gallery-content-center');
var wm;
@PofMagicfingers
PofMagicfingers / nuke_magento_orders_and_customers.sql
Last active Dec 14, 2017
Remove all user data from magento
View nuke_magento_orders_and_customers.sql
# source : https://www.designhaven.co.uk/2014/08/cleanly-delete-orders-sales-customer-data-magento/
SET FOREIGN_KEY_CHECKS=0;
##############################
# SALES RELATED TABLES
##############################
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
View gist:4e8c2d72b98e52526507501e10977c63
Verifying that "pofmagicfingers.id" is my Blockstack ID. https://onename.com/pofmagicfingers
@PofMagicfingers
PofMagicfingers / vlc_remaining.rb
Created Aug 9, 2017
Show remaining time in vlc, and current listener count in a icecast webradio
View vlc_remaining.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
VLC_URL = "http://vlc:8080/requests/status.xml"
ICECAST_STATUS = "http://webradio:8000/status2.xsl"
l_count = 0
ccount = 0
You can’t perform that action at this time.