Skip to content

Instantly share code, notes, and snippets.

View X4's full-sized avatar
:shipit:
❯ Building Some Capital

X4 X4

:shipit:
❯ Building Some Capital
  • (𝙰𝙸, 𝙲𝙼𝙿𝚁𝚂𝚂𝙽, 𝙲𝚛𝚢𝚙𝚝𝚘)
  • Dubai, UAW
  • 11:47 (UTC +04:00)
  • X @X4AES
  • X @SomeCapitalX
View GitHub Profile
@X4
X4 / imgtoedj.sh
Last active December 15, 2015 13:38 — forked from tomoe-mami/imgtoedj.sh
#!/bin/sh
set -e
# Set the path to your own wallpaper directory
WALLPAPER_PATH="$HOME/Bilder/Sample Pictures"
NEXT_WALLPAPER="$HOME/Bilder/Sample Pictures/006.jpg"
FILENAME="006.jpg"
OUTPUT_DIR="$HOME/.e/e/backgrounds"
TEMPLATE='
@X4
X4 / git-mysql-howto.md
Last active December 19, 2015 06:49
Git Dude and Git MySQL HowTo https://github.com/sickill/git-dude

Hi!

I have lots of repositories locally and on my servers, but I follow even more repositories and I contribute to some here and there. That's why I've the need to stay notified when there is a change. But I don't want to actively follow through RSS or E-Mail. A commit notification isn't worth bloating my inbox even more.

For those who don't know, there is a cool way to keep notified of commits etc. and to exchange messages. You can use IRC in combination with a git hook through cia.vc/ or github.com/ itself, even bitbucket.org supports it now. Otherwise just setup an eggdrop, supybot or the phergie IRC Bot and write a script for it. You can share it here if you want.

It's obvious that a snapshot of your application only makes sense when you also add a database snapshot to it. That's why I'll explain howto create a git hook to take database dumps on each commit or tag.

GIT based Database version control.

Go to the hidden .git folder in your project, then a sub folder in there called hooks

@X4
X4 / flattenMatrix().cs
Last active December 19, 2015 11:49
Converting example using yield and the iterator approach to a basic loop or using LINQ.
// Your current code
public static IEnumerable<T> Flatten<T>(this T[,] matrix)
{
var rows = matrix.GetLength(0);
var cols = matrix.GetLength(1);
for (var i = 0; i < rows;i++ )
{
for (var j = 0; j < cols; j++ )
yield return matrix[i, j];
}
@X4
X4 / autocomplete.zsh
Last active July 28, 2025 17:40
some zsh modules
#
# Sets completion options.
#
# Load and initialize the completion system ignoring insecure directories.
zmodload zsh/complist
autoload -Uz compinit && compinit -i
autoload -U colors ; colors
zle -C complete-menu menu-select _generic
@X4
X4 / gentoo-rebel.xml
Created October 15, 2013 10:47
git clone https://gist.github.com/6989788.git /etc/layman/overlays/gentoo-rebel
<?xml version="1.0" encoding="UTF-8"?>
<layman>
<overlay contact="" name="gentoo-rebel" src="git://github.com/X4/gentoo-rebel.git" type="git">
<link>
http://github.com/X4/gentoo-rebel
</link>
<description>
Rebel Gentoo Overlay
</description>
</overlay>
@X4
X4 / Thesis.tex
Last active December 26, 2015 21:09
Thesis Master Template
%&Thesis
% Create a binary preamble:
% fmtutil --byfmt pdflatex
% check for mistakes in the code
\RequirePackage[l2tabu, orthodox]{nag}
% permit Computer Modern fonts at arbitrary sizes.
\RequirePackage{fix-cm}
@X4
X4 / appendix.tex
Created December 2, 2013 21:40
LaTeX: Formats the Appendix to the form of: A.1, B.1, B.2.1
\documentclass{book}
\usepackage[toc,title,page]{appendix}
\begin{document}
\tableofcontents
\appendix
\renewcommand{\thesection}{\Alph{section}.\arabic{section}}
\setcounter{section}{0}
@X4
X4 / fix-koala
Last active January 4, 2016 18:39
Generic LD_LIBRARY_PATH override wrapper used for https://github.com/oklai/koala/issues/161 to fix koala's nodewebkit issue complaining that libudev.so.0 is missing.
#!/bin/bash
# @author X4
# @date 2014-28-01
# This makes my life easier, when people use outdated shared libraries
BIN="${BASH_SOURCE##*-}"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SHARED_LIB="libudev.so.0"
SHARED_SOURCE="/opt/google/chrome/"
doctype 5
html(lang='de')
head
meta(charset='utf-8')
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1.0')
title website-title
link(href='stylesheets/normalize.css', rel='stylesheet', media='all')
@X4
X4 / ua.php
Created January 29, 2014 02:09
Primitive Mobile only UA detection.
<?php
function getUA()
{
$useragent = $_SERVER['HTTP_USER_AGENT'];
$mobile_ua = '/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i';
$mobile_ua_alt = '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|i