Skip to content

Instantly share code, notes, and snippets.

View abits's full-sized avatar

Christoph Martel abits

  • Stuttgart, Germany
View GitHub Profile
@abits
abits / macOS keyboard layout for Linux
Created September 26, 2023 12:32 — forked from rbreaves/macOS keyboard layout for Linux
Universal macOS keyboard layout for Linux - Applies to All Windows and Apple Keyboards
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
@abits
abits / ocp.php
Created May 22, 2017 14:15 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@abits
abits / .gitlab-ci.yml
Created February 18, 2017 23:45 — forked from DennisAlund/.gitlab-ci.yml
Automatic deployment of Google App Engine project with Gitlab Continuous Integration - https://medium.com/evenbit/an-easy-guide-to-automatically-deploy-your-google-app-engine-project-with-gitlab-ci-48cb84757125
image: python:2.7
before_script:
- echo "deb http://packages.cloud.google.com/apt cloud-sdk-jessie main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list
- curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- apt-get update && apt-get install google-cloud-sdk
after_script:
- rm /tmp/$CI_PIPELINE_ID.json
@abits
abits / gist:2aed9527d448cf7ffc834184e8db6fda
Created April 11, 2016 12:42 — forked from ismasan/gist:3804361
async fetching of urls using goroutines and channels
package main
import (
"fmt"
"net/http"
"time"
)
var urls = []string{
"http://pulsoconf.co/",
@abits
abits / dict_to_object.py
Created February 22, 2016 16:05 — forked from lachezar/dict_to_object.py
Python dict to object
config_dict = {
'group1': {
'server1': {
'apps': ('nginx', 'mysql'),
'cpus': 4
},
'maintenance': True
},
'firewall_version': '1.2.3',
'python2.7': True
@abits
abits / gulpfile.js
Last active August 29, 2015 14:23 — forked from insin/gulpfile.js
var gulp = require('gulp')
var shell = require('gulp-shell')
gulp.task('build-docs', shell.task('make html', {cwd: './docs'}))
gulp.task('docs', ['build-docs'], function() {
gulp.watch(['./docs/*.rst', './docs/*.py'], ['build-docs'])
})
Exercise: Nutrition Facts
Create an empty webpage.
Download nutrition.xml from https://gist.github.com/3000322 and place in your project folder.
Use AJAX via jQuery or JS API to fetch the file into the page.
Create a table. For each <food> in the XML file, create a row in the table with the food name and nutritional facts - serving size, calories, carbs.
Bonus: Use the tablesorter jQuery plugin to make the table sortable by the nutritional facts.
Exercise: Lady Gaga News
@abits
abits / gulpfile.js
Last active August 29, 2015 14:21 — forked from mlouro/gulpfile.js
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');
@abits
abits / gulpfile.js
Last active August 29, 2015 14:21 — forked from Raynos/gulpfile.js
/*
This is an EXAMPLE gulpfile.js
You'll want to change it to match your project.
Find plugins at https://npmjs.org/browse/keyword/gulpplugin
*/
var gulp = require('gulp');
var uglify = require('gulp-uglify');
gulp.task('scripts', function() {
// Minify and copy all JavaScript (except vendor scripts)
'''
Credit to Adam Presley, who's ftpsyncing fabfile I used as a starting point
http://adampresley.com/#!post/2013/04/how-i-deployed-a-php-app-via-ftp-using-fabric-and-git
'''
import fabric
import ftplib
import re
import os
from git import *
from ftplib import FTP