Skip to content

Instantly share code, notes, and snippets.

View petrbel's full-sized avatar

Petr Bělohlávek petrbel

View GitHub Profile
@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@maly
maly / gist:8068264
Created December 21, 2013 11:39
Generátor disassembleru pro Z80
function toHex2($n) {
$o = dechex($n);
if (strlen($o)<2) $o='0'.$o;
return strtoupper($o);
};
function genrl($code,$ins, $DD, $IX) {
$n = '';
$n .= " case '${DD}CB".toHex2($code+0)."': return '".$ins." ($IX+'+p2+'),B';\n";
$n .= " case '${DD}CB".toHex2($code+1)."': return '".$ins." ($IX+'+p2+'),C';\n";
case class Person(firstName: String, lastName: String, male: Boolean)
val people = List(
Person("Veronika", "Skalova", false),
Person("Jana", "Heroutova", false),
Person("Miroslav", "Klepis", true))
for (Person(_, lastName, false) <- people) yield "Pani " + lastName
// Pani Skalova, Pani Heroutova
@zhongwen
zhongwen / eudist_sse.cc
Created November 2, 2012 18:25
Euclidean distance with SSE
static inline float euclidean_baseline_float(const int n, const float* x, const float* y){
float result = 0.f;
for(int i = 0; i < n; ++i){
const float num = x[i] - y[i];
result += num * num;
}
return result;
}
static inline float euclidean_intrinsic_float(int n, const float* x, const float* y){
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@Blaisorblade
Blaisorblade / ExtraSettings.tex
Created February 2, 2012 11:13
LaTeX listings: add support for Scala
% Other listings-related settings from
% http://lampsvn.epfl.ch/trac/scala/export/26099/scala-tool-support/trunk/src/latex/scaladoc.sty
% activate the language and predefine settings
\lstset{
language=Scala,%
xleftmargin=4mm,%
aboveskip=3mm,%
belowskip=3mm,%
fontadjust=true,%
columns=[c]fixed,%