Skip to content

Instantly share code, notes, and snippets.

View keikoro's full-sized avatar
🦈
いいえ

k keikoro

🦈
いいえ
View GitHub Profile
@keikoro
keikoro / FF_HTMLbookmarks_toCSV.js
Last active April 13, 2024 23:36
JavaScript bookmarklet for converting HTML-formatted Firefox bookmarks into a downloadable CSV file
javascript:(function(){
/* escape quotes and commas in contents to be comma-separated */
function wrapCsvContents(content) {
if (typeof(content) === 'string') {
if (content.replace(/ /g, '').match(/[\s,"]/)) {
return '"' + content.replace(/"/g, '""') + '"';
}
}
return content;
}
@keikoro
keikoro / remote repo from CLI.md
Last active April 19, 2020 18:41
Create a new remote repository on GitHub from the command line.

there's a bash script for this now: clirepo

@keikoro
keikoro / jitai.user.js
Created December 9, 2018 00:43 — forked from obskyr/jitai.user.js
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
// ==UserScript==
// @name Jitai
// @version 1.3.2
// @description Display WaniKani reviews in randomized fonts, for more varied reading training.
// @author Samuel (@obskyr)
// @copyright 2016-2018, obskyr
// @license MIT
// @namespace http://obskyr.io/
// @homepageURL https://gist.github.com/obskyr/9f3c77cf6bf663792c6e
// @icon http://i.imgur.com/qyuR9bD.png
@keikoro
keikoro / repo_from_cli.md
Last active November 14, 2018 15:42
Create repositories on GitHub, GitLab, Bitbucket from the command line.

there's a bash script for this now: clirepo

@keikoro
keikoro / .block
Last active August 21, 2017 11:27
Simple, static SVG bar chart – D3.js v4
license: mit
@keikoro
keikoro / git_cheatsheet.md
Last active April 12, 2017 16:36
git – personal cheat sheet

Committing

empty initial commit
$ git commit --allow-empty -m "initial commit"

Branches

create a "blank" branch (coming from an existing branch)
and remove all files and directories in the current directory
$ git checkout --orphan newbranch

@keikoro
keikoro / csv2htmllist.py
Last active November 1, 2016 15:37
Convert a .csv with URLs and URL descriptions to HTML list elements
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
filename = 'inputsheet.csv'
delimiter = ','
with open(filename, newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=delimiter)
@keikoro
keikoro / git_collaborators.md
Last active October 22, 2016 21:40
show, add, delete collaborators on a git repository on GitHub from the CLI

list collaborators
-X GET is optional
$ curl -u 'USERNAME' -X GET https://api.github.com/repos/USERNAME/REPONAME/collaborators

add a collaborator
$ curl -u 'USERNAME' -X PUT -d '' https://api.github.com/repos/USERNAME/REPONAME/collaborators/COLLABORATORNAME

delete a collaborator
-d '' is optional
$ curl -u 'USERNAME' -X DELETE -d '' https://api.github.com/repos/USERNAME/REPONAME/collaborators/COLLABORATORNAME

@keikoro
keikoro / compile C on Mac
Last active December 24, 2015 23:49
Compile C on Mac OS X using the command line instead of e.g. Xcode. Requires GCC (GNU Compiler Collection) to be installed, which is part of Command Line Tools (which can be installed through Xcode or as separate developer package).
# gcc start GNU compiler
# -Wall [optional] flag to show warnings (all possible warnings)
# $DESIREDEXECUTABLENAME [optional] name of resulting executable file; otherwise gcc auto-outputs to a.out
# $MYFILE.c C file that should get compiled
gcc -Wall $DESIREDEXECUTABLENAME $MYFILE.c
@keikoro
keikoro / replace group permissions
Created August 11, 2013 18:17
Replace group permissions of certain files.
# ~ find in $HOME
# fdl file types: f = file, d = directory, l = symbolic link
# $GROUP current group permission
# -exec do something with found files
# :$NEWGROUP new group permission (needs leading colon! -> chown owner:group)
# {} placeholder for each found file
# \; escape the semicolon that ends the -exec part of the command
find ~ -type fdl -group $GROUP -print -exec chown :$NEWGROUP {} \;