Skip to content

Instantly share code, notes, and snippets.

@davidsklar
davidsklar / fix-broken-utf-8.php
Created August 25, 2015 17:23
Fixing Broken UTF-8
<?php
function fixBrokenUTF8($contents) {
static $replacement = chr(0xEF) . chr(0xBF) . chr(0xBD);
$expectingNewChar = true;
$expectedLength = 0;
$expectedIndex = 0;
$i = 0;
$out = "";
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active April 25, 2024 12:35
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@bbudd
bbudd / assets.md
Created June 13, 2019 12:30
Loading static assets using electron-forge v6 and the webpack plugin

I spent a few hours chasing down just how to get my static assets (css, fonts, images) to load in an Electron app built using electron-forge v6 (https://www.electronforge.io/) and its webpack plugin (https://www.electronforge.io/config/plugins/webpack) while in development mode. There really isn't any documentation available online, either in the electron-forge documentation or in places like blogs or gists or stackoverflow. So I thought I'd put it down here.

Step 1

Load CopyWebpackPlugin npm i -D copy-webpack-plugin


Step 2

Use the plugin to move your directories into place.

@JinKwonJeon
JinKwonJeon / gist:38d1fd3cbf65fff7a5b9a854dba46163
Created March 2, 2024 11:57
엑셀 시트 나누기 VBA 마스터 코드 (시트 & PDF 저장)
Public Enum ePrintMargin: xlNone = 0: xlNarrow = 1: xlNormal = 2: xlWide = 3: End Enum
Public Enum ePaperSize: xlA4 = 9: xlA3 = 8: xlLetter = 1: xlA5 = 11: End Enum
'-------------------------------------------------
Sub 엑셀파일로저장()
'여기를 선택 후, F5키를 누르면 각 시트를 나누어 저장합니다.
Dim Path As String: Path = GetFolderPath
If Path = "" Then MsgBox "올바른 폴더 경로를 선택하세요.": Exit Sub
@voluntas
voluntas / webrtc.rst
Last active April 25, 2024 12:30
WebRTC コトハジメ
@mooware
mooware / gnu-libc-print-stacktrace.c
Last active April 25, 2024 12:29
Print a stacktrace on Linux with GNU libc
// this code fragment shows how to print a stack trace (to stderr)
// on Linux using the functions provided by the GNU libc
#include <execinfo.h>
#define MAX_STACK_LEVELS 50
// helper-function to print the current stack trace
void print_stacktrace()
{
private val DefaultHighlightWidth = 136.dp
private val DefaultDuration = 1200.milliseconds
private val DefaultDelay = 1.seconds
private val DefaultStartColor = Color(0x32394A00)
private val DefaultMiddleColor = Color.White
private val DefaultEndColor = DefaultStartColor
private const val DefaultAlpha = 0.2F
private val DefaultShape = RoundedCornerShape(12.dp)
@Composable
@ricksladkey
ricksladkey / log.py
Last active April 25, 2024 12:27
Example Python script for GDB that reads and displays the text in a ring buffer every time the program stops
from __future__ import print_function
import struct
import gdb
def log():
# Get the inferior.
try:
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 25, 2024 12:27
国内的 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+