Skip to content

Instantly share code, notes, and snippets.

@wutangpaul
wutangpaul / kitty.conf
Last active November 22, 2023 10:20
My current kitty.conf, using Fira Code and Dracula theme via https://github.com/dexpota/kitty-themes
# vim:fileencoding=utf-8:ft=conf
# Font family. You can also specify different fonts for the
# bold/italic/bold-italic variants. By default they are derived automatically,
# by the OSes font system. Setting them manually is useful for font families
# that have many weight variants like Book, Medium, Thick, etc. For example:
# font_family Operator Mono Book
# bold_font Operator Mono Thick
# bold_italic_font Operator Mono Medium
# font_family Input Mono
@wutangpaul
wutangpaul / getCrossDomainCookieUrl.js
Last active October 6, 2023 22:12
Get cross domain hostname for cookies
getCrossDomainCookieUrl = (url) => {
// parse a URL using the WHATWG URL API
const myURL = new URL("https://new.petsafe.com:81/foo");
// Remove all subdomains
myURL.hostname = myURL.hostname.replace(/^([^\.]+)\./, "");
console.log(myURL.hostname);
};
@wutangpaul
wutangpaul / split_csv.sh
Created April 13, 2021 14:18
Split a large CSV file into smaller files
#!/bin/bash
FILENAME=orders.csv
HDR=$(head -1 $FILENAME)
split -l 5000 $FILENAME xyz
n=1
for f in xyz*
do
if [ $n -gt 1 ]; then
echo $HDR > Part${n}-$FILENAME
fi
@wutangpaul
wutangpaul / .hyper.js
Last active November 2, 2021 23:15
Hyper.js terminal settings, with ohmyzsh and spaceship
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
@wutangpaul
wutangpaul / foo.sh
Created June 23, 2020 20:58
Enable syntax highlighting for all the things in nano
find /usr/share/nano/ -iname "*.nanorc" -exec echo include {} \; >> ~/.nanorc
@wutangpaul
wutangpaul / App.js
Created January 15, 2020 23:34
styled components child hover
import React from "react";
import styled from "styled-components";
const NavBar = styled.div`
background-color: cornflowerblue;
padding: 1rem;
`;
const FlyoutMenu = styled.div`
background-color: limegreen;
@wutangpaul
wutangpaul / .eslintrc.js
Created August 27, 2019 08:15
My eslint/Airbnb setup to work with out of the box Prettier
module.exports = {
env: {
commonjs: true,
es6: true,
node: true
},
extends: "airbnb-base",
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly"
@wutangpaul
wutangpaul / gist:80ad318079bd62ff4b2abe4df76ee88c
Created October 26, 2017 09:52
Data row loop - Angular vs React
// Angular 1.x
<tr ng-repeat="friend in friends">
<td>{friend.name}</td>
</tr>
// React/JSX
{this.props.friends.map(function(friend) {
return (
<tr key={friend.guid}>
<td> {friend.name} </td>
@wutangpaul
wutangpaul / commands.md
Last active March 15, 2017 14:43
Useful git commands

Create a new local git repository in current directory

git init

Check out (and switch to) remote branch

git checkout <remote branch name>

Update current branch

@wutangpaul
wutangpaul / Vagrantfile
Created August 31, 2016 13:34
Vagrant box with Ubuntu 14.04 + Go
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-14.04"
config.vm.provision :shell, :path => "provision.sh", privileged: false
config.vm.network "forwarded_port", guest: 8080, host: 8080
end