Skip to content

Instantly share code, notes, and snippets.

View claudioc's full-sized avatar

Claudio Cicali claudioc

View GitHub Profile
If you use fish and want to try Powerline:
Install oh-my-fish https://github.com/oh-my-fish/oh-my-fish
Install bobthefish (for the git support)
Follow the instructions above, or:
1. Install fisherman (https://github.com/fisherman/fisherman)
2. Install powerline with `sudo pip install powerline-status` (or https://github.com/banga/powerline-shell not sure about the diff)
3. Install shellder with `sudo fisher install simnalamburt/shellder` (https://github.com/simnalamburt/shellder)
4. Install powerline-patched fonts (https://github.com/powerline/fonts)

Keybase proof

I hereby claim:

  • I am claudioc on github.
  • I am claudioc (https://keybase.io/claudioc) on keybase.
  • I have a public key ASA_hkQ1KiU7760d2e-ghPssGqF3VxwlByw4OEtp4ZA4WAo

To claim this, I am signing this object:

function getUpdates() {
updateCell("B3", "ripple")
updateCell("C3", "bitcoin")
updateCell("D3", "ethereum")
updateCell("E4", "litecoin")
updateCell("F4", "iota")
}
function updateCell(cell, code) {
const response = UrlFetchApp.fetch("https://api.coinmarketcap.com/v1/ticker/" + code + "/?convert=EUR")
/* This can be the start of a module */
const makeHandler = cb => {
return {
get (object, prop, receiver) {
if (Reflect.has(object, prop)) {
return Reflect.get(...arguments)
}
return new Proxy(() => {}, {
@claudioc
claudioc / g.sh
Last active August 13, 2018 16:00
Simplest git shortcuts wrapper
#!/usr/bin/env bash
# Simple shortcut wrapper to your most common git commands
# Easy to extend, and passes all the unrecognized command through the
# `git` command itself (i.e. `g rebase master` => `git rebase master`)
# Traps any error (see https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html)
set -e -o pipefail -u
cmd=${1}
argc=${#}
-- Contenuto del tsconfig.json
{
// Enable support for importing CommonJS modules targeting es6 modules
"esModuleInterop": true,
// When using above interop will get missing default export error from type check since
// modules use "export =" instead of "export default", enable this to ignore errors.
"allowSyntheticDefaultImports": true
}
import * as fs from 'fs'
import * as path from 'path'
import { promisify } from 'util'
// About returning promises inside an async ts method
// https://github.com/Microsoft/TypeScript/issues/5254
type ScanDirOptions = {
match?: RegExp
exclude?: RegExp
@claudioc
claudioc / user.screenshot.drop_shadow.plist
Last active May 29, 2020 17:01
Plist file to execute a custom script when a directory changes
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>usr.screenshot.drop_shadow</string>
<key>ProgramArguments</key>
<array>
<string>/Users/claudioc/bin/drop_shadow.sh</string>
<string>--last-screenshot</string>
@claudioc
claudioc / drop_shadow.sh
Created May 29, 2020 17:05
Script which finds the newest screenshot image and adds a shadow to it
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
echo "Needs the filename as the first argument"
exit -1
fi
type /usr/local/bin/convert >/dev/null 2>&1 || { echo >&2 "The convert command must be available."; exit 1; }
input_filename="${1}"
@claudioc
claudioc / secretary_problem.py
Created August 30, 2020 16:51
The secretary problem
#!/usr/bin/env python
import random
from math import e
n_runs = 1000
n_scores = 1000
score_max = 1000000
def main():