Skip to content

Instantly share code, notes, and snippets.

Kamikat kamikat

Block or report user

Report or block kamikat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kamikat
kamikat / react-component-package.patch
Last active Oct 11, 2019
Convert CRA project to re-distributable component package.
View react-component-package.patch
diff --git a/.gitignore b/.gitignore
index 4d29575..3835823 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+
+/dist
@kamikat
kamikat / logger.js
Created Nov 13, 2018
Colorized logger of winston@3.x (boilerplate)
View logger.js
const process = require('process');
const winston = require('winston');
const clc = require('cli-color');
const {
TERM = '',
LOG_LEVEL = 'info'
} = process.env;
const colors = ~TERM.indexOf('256') ? {
@kamikat
kamikat / date.js
Created Nov 13, 2018
Native JavaScript date manipulation, inspired by https://github.com/you-dont-need/You-Dont-Need-Momentjs.
View date.js
const startOf = {
d: (d) => {
d.setHours(0, 0, 0, 0);
return d;
},
w: (d) => {
d.setDate(d.getDate() - (d.getDay() || 7) + 1);
d.setHours(0, 0, 0, 0);
return d;
},
@kamikat
kamikat / volume-command.sh
Created Oct 19, 2018
Backup & restore a local volume from docker.
View volume-command.sh
#!/bin/sh
BUSYBOX_IMAGE=${BUSYBOX_IMAGE:-busybox}
BUSYBOX_IMAGE_ID=$(docker images -q $BUSYBOX_IMAGE | head -n1)
check_busybox() {
if [ -z "$BUSYBOX_IMAGE_ID" ]; then
echo >&2 "error: $BUSYBOX_IMAGE image not found."
exit 1
fi
@kamikat
kamikat / exiftool-android.md
Last active Nov 13, 2018
Setup exiftool command for Terminal Emulator on Android (ROOT required).
View exiftool-android.md
@kamikat
kamikat / eri.xml
Last active Jun 2, 2018
ERI file to set LTE network name (fix "Roaming Indicator OFF" problem with LineageOS capricorn).
View eri.xml
<?xml version="1.0" encoding="UTF-8"?>
<EriFile VersionNumber="1357" NumberOfEriEntries="14" EriFileType="1">
<CallPromptId Id="0" CallPromptText="CallPromptId0" />
<CallPromptId Id="1" CallPromptText="CallPromptId1" />
<CallPromptId Id="2" CallPromptText="CallPromptId2" />
<EriInfo RoamingIndicator="0" IconIndex="1" IconMode="0" EriText="CT-LTE Roam" CallPromptId="0" AlertId="0" />
<EriInfo RoamingIndicator="1" IconIndex="1" IconMode="0" EriText="CT-LTE" CallPromptId="0" AlertId="0" />
<EriInfo RoamingIndicator="2" IconIndex="1" IconMode="0" EriText="CT-LTE Roam" CallPromptId="0" AlertId="0" />
<EriInfo RoamingIndicator="65" IconIndex="65" IconMode="0" EriText="T-CDMA 65" CallPromptId="0" AlertId="0" />
<EriInfo RoamingIndicator="66" IconIndex="1" IconMode="0" EriText="T-CDMA Ext 66" CallPromptId="0" AlertId="0" />
@kamikat
kamikat / logger.js
Created May 23, 2018
256color compatible logger configuration for winston.
View logger.js
var clc = require('cli-color');
var { Logger, transports } = require('winston');
var { formatter, timestamp } = require('winston-console-formatter')({
colors: ((term) => (~term.indexOf('256')) ? {
silly: clc.xterm(33),
debug: clc.xterm(207),
info: clc.xterm(48),
warn: clc.xterm(226),
error: clc.xterm(196),
@kamikat
kamikat / traceroute.py
Last active May 4, 2018
Traceroute implementation in Python 2.
View traceroute.py
#!/usr/bin/env python2.7
import argparse
import socket
import struct
import random
import time
MAX_HOP=64
MAX_ICMP_PACKET_SIZE=1508
@kamikat
kamikat / sshfs-1
Last active Mar 26, 2018
Blocking version of sshfs.
View sshfs-1
#!/bin/bash
DATA_PATH=${DATA_PATH:-$2}
if [ -z "$DATA_PATH" ]; then
sshfs -h
exit 1
fi
LOCK_PATH=$DATA_PATH/.lock-$RANDOM
@kamikat
kamikat / telegram.scpt
Created Oct 3, 2017
AppleScript to restart Telegram Desktop.app
View telegram.scpt
if application "Telegram Desktop" is running then
tell application "Telegram Desktop"
quit
end tell
delay 3
tell application "Telegram Desktop"
launch
end tell
end if
You can’t perform that action at this time.