Skip to content

Instantly share code, notes, and snippets.

View ttys3's full-sized avatar
💭
sad, ttyS0 has been taken by other user

ttys3

💭
sad, ttyS0 has been taken by other user
View GitHub Profile
@ttys3
ttys3 / Dockerfile
Created January 20, 2020 06:15 — forked from hermanbanken/Dockerfile
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@ttys3
ttys3 / using-proxy-for-git-or-github.md
Last active October 15, 2022 02:15 — forked from coin8086/using-proxy-for-git-or-github.md
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand ncat --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p
@ttys3
ttys3 / example-spec-files.md
Created February 11, 2020 16:57 — forked from ruario/example-spec-files.md
Example rpm .spec files for recent versions of Opera.

The following are some example .spec files I created to demonstrate how to deal with a more recent libudev version and the different naming of libcrypto on Fedora, via the use of compatibility symlinks. I do this in post install for maximum compatibility as the resultant rpms could also be used on systems where libudev and libcrypto naming matches what Opera expects.

To fetch all the .spec files:

git clone https://gist.github.com/f0183807a9f708067475.git

Place the version of Opera you wish to repackage in your sources directory (usually ~/rpmbuild/SOURCES). Tweak the Version field in the .spec file(s).

To repackage Opera stable:

@ttys3
ttys3 / ocp.php
Created February 21, 2020 14:21 — 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
@ttys3
ttys3 / CentOS 8 aarch64 rootfs creation.txt
Last active March 26, 2020 19:01 — forked from imcsk8/gist:78efd778b36bc6f3a29a872655643c79
CentOS 8 aarch64 rootfs creation
$ mkdir repos
$ cat <<EOF>> repos/centos.repo
[main]
arch=aarch64
basearch=aarch64
[centos8-base]
name=CentOS-8-Base
baseurl=http://mirror.centos.org/centos/8/BaseOS/aarch64/os/
gpgcheck=0
@ttys3
ttys3 / absolutePosition.js
Created March 10, 2020 12:18 — forked from LiamChapman/absolutePosition.js
Absolute Position of Element in Javascript
if (typeof absolutePosition == "undefined") {
// Discovered here: http://stackoverflow.com/a/32623832/867154
// Many thanks to @RoboCat!
function absolutePosition (el) {
var found, left = 0, top = 0, width = 0, height = 0, offsetBase = absolutePosition.offsetBase;
if (!offsetBase && document.body) {
offsetBase = absolutePosition.offsetBase = document.createElement('div');
offsetBase.style.cssText = 'position:absolute;left:0;top:0';
@ttys3
ttys3 / post-receive-redmine.sh
Last active March 22, 2020 06:36 — forked from colinmollenhour/post-receive-redmine.sh
gitolite update hooks to reject CRLF line endings and require formatted commit messages
#!/bin/bash
#
# see https://github.com/kahseng/redmine_gitolite_hook/blob/master/README.rdoc
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
@ttys3
ttys3 / CentOS-Docker
Created March 26, 2020 19:00 — forked from silveraid/CentOS-Docker
Creating minimal CentOS docker image from scratch
# Create a folder for our new root structure
$ export centos_root='/centos_image/rootfs'
$ mkdir -p $centos_root
# initialize rpm database
$ rpm --root $centos_root --initdb
# download and install the centos-release package, it contains our repository sources
$ yum reinstall --downloadonly --downloaddir . centos-release
$ rpm --root $centos_root -ivh centos-release*.rpm
$ rpm --root $centos_root --import $centos_root/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# install yum without docs and install only the english language files during the process
Cache Latency CPU cycles Size
L1 access ~1.2 ns ~4 Between 32 KB and 512 KB
L2 access ~3 ns ~10 Between 128 KB and 24 MB
L3 access ~12 ns ~40 Between 2 MB and 32 MB
@ttys3
ttys3 / hugofastsearch.md
Created June 3, 2020 10:40 — forked from cmod/hugofastsearch.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search