Skip to content

Instantly share code, notes, and snippets.

@ejointjp
ejointjp / css.php
Created October 25, 2014 06:08
CSSをPHPで書く方法
<?php
//CSSとして使うPHPファイルの一番上に記述
header('Content-Type: text/css;', 'charset=utf-8'); ?>
@charset "utf-8";
<?php
//後はCSSを書く!
$bgcolor = 'pink';
?>
@UbadahJ
UbadahJ / FilterableListAdapter.kt
Last active May 5, 2024 02:25
A filterable ListAdapter for RecyclerView
abstract class FilterableListAdapter<T, VH : RecyclerView.ViewHolder>(
diffCallback: DiffUtil.ItemCallback<T>
) : ListAdapter<T, VH>(diffCallback), Filterable {
private var originalList: List<T> = currentList.toList()
override fun getFilter(): Filter {
return object : Filter() {
override fun performFiltering(constraint: CharSequence?): FilterResults {
return FilterResults().apply {
@mkfares
mkfares / zsh-keyboard-shortucts.md
Last active May 5, 2024 02:22
Common zsh Keyboard Shortcuts on macOS Catalina

Common zsh Keyboard Shortcuts on macOS

Navigation

CTRL + A : Move the cursor to the beginning of the line
CTRL + E : Move the cursor to the end of the line
OPTION + Left Arrow : Move the cursor one word backward
OPTION + Right arrow : Move the cursor one word forward
Left Arrow : Move the cursor one character backward
Right Arrow : Move the cursor one character forward

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 5, 2024 02:19
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@jcrsilva
jcrsilva / task.py
Created November 26, 2019 23:27
Codility solution for gas station problem
#!/usr/bin/env python3
class Pump(object):
def __init__(self, fuel_capacity):
self.fuel_capacity = fuel_capacity
self.car = None
class GasStation(object):
@tony722
tony722 / sendmail-gcloud
Last active May 5, 2024 02:13
Freepbx Voicemail Transcription Script: Google Speech API
#!/bin/sh
# sendmail-gcloud
#
# Installation instructions
# Copy the content of this file to /usr/sbin/sendmail-gcloud
#
# Google Account
# ---------------
# Create a Google Cloud account if you don't have one yet. Free trial is available at https://console.cloud.google.com/freetrial
@kklouzal
kklouzal / LuaClassBinding.cpp
Created November 2, 2017 23:41
Binding A C++ Class To Lua The Manual Way (shared_ptr memory management)
#include <lua.hpp> // LuaJIT header
#include <iostream> // Access to std::system("PAUSE")
#include <memory>
// A simple class to be bound in our Lua environment.
class MyClass
{
public:
MyClass()
{
@Vankalif
Vankalif / mosaic.vlm
Last active May 5, 2024 02:06
VLC 6 ip cameras mosaic config via RTSP
# Runs on windows by command -> vlc --vlm-conf path_to_file.vlm
# Background options
new bg broadcast enabled
# bg just plain black background jpg image
setup bg input "C:\Users\full_path_to\back.jpg"
setup bg option image-duration=-1
setup bg output #transcode{sfilter=mosaic{width=1920,height=960,cols=3,rows=2,position=1,order="1,2,3,4,5,6",keep-aspect-ratio=enabled,keep-picture=1,mosaic-align=5},vcodec=mp4v,vb=2000,fps=15}:duplicate{dst=display}
# Input options
@davidfowl
davidfowl / dotnetlayout.md
Last active May 5, 2024 02:03
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@royshil
royshil / cylindricalWarping.py
Last active May 5, 2024 01:58
Warp an image to cylindrical coordinates for cylindrical panorama stitching, using Python OpenCV
import cv2
import numpy as np
def cylindricalWarp(img, K):
"""This function returns the cylindrical warp for a given image and intrinsics matrix K"""
h_,w_ = img.shape[:2]
# pixel coordinates
y_i, x_i = np.indices((h_,w_))
X = np.stack([x_i,y_i,np.ones_like(x_i)],axis=-1).reshape(h_*w_,3) # to homog
Kinv = np.linalg.inv(K)