Skip to content

Instantly share code, notes, and snippets.

@svx
svx / gitget.py
Created February 12, 2020 09:58 — forked from divs1210/gitget.py
Download a specific folder from a github repo
#!/usr/bin/python
"""
Download a specific folder from a github repo:
gitget.py https://github.com/divs1210/kilvish/tree/master/examples/bricksnball
"""
__author__ = 'Divyansh Prakash'
import sys
import subprocess
@svx
svx / gist:75dc081c0464c1ac8b81092eef7e214a
Created January 29, 2020 16:25 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@svx
svx / swagger.py
Created September 26, 2019 14:35 — forked from jdkato/swagger.py
import subprocess
import sys
# pip install PyYAML
import yaml
def lint_keys(data, keys):
"""Recursively lint the given data.
"""
@svx
svx / export-google-docs-to-restructured-text.js
Created August 9, 2019 09:57 — forked from simonw/export-google-docs-to-restructured-text.js
Google Apps script to convert a Google Docs document into reStructuredText
function onOpen() {
var ui = DocumentApp.getUi();
ui.createMenu('Convert to .RST')
.addItem('Convert to .RST and email me the result', 'ConvertToRestructuredText')
.addToUi();
}
// Adopted from https://github.com/mangini/gdocs2md by Renato Mangini
// License: Apache License Version 2.0
String.prototype.repeat = String.prototype.repeat || function(num) {
@svx
svx / pre-commit.lint
Created April 5, 2019 10:14 — forked from mindbat/pre-commit.lint
Git pre-commit script to run all the modified files through php-lint. Won't let you commit php file with a syntax error.
#!/bin/sh
#
# Hook script to check the changed files with php lint
# Called by "git commit" with no arguments.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
pipeline:
linkcheck:
image: testthedocs/ttd-linkcheck
commands: su-exec ttd /usr/local/bin/linkcheck -c '200,301,302' -t 5 docs
vale:
image: testthedocs/ttd-vale
commands: su-exec ttd vale --config='/srv' docs
@svx
svx / package.json
Created November 12, 2018 15:20 — forked from oroce/package.json
run eslint only on changed (*.js files) files using pre-commit
{
"scripts": {
"eslint": "LIST=`git diff-index --name-only HEAD | grep .*\\.js | grep -v json`; if [ \"$LIST\" ]; then eslint $LIST; fi"
},
"devDependencies": {
"pre-commit": "0.0.7",
"eslint": "~0.5.1"
},
"pre-commit": [
"eslint"
@svx
svx / drupal7_to_hugo.php
Created November 12, 2018 05:51 — forked from amoutiers/drupal7_to_hugo.php
A basic php script to migrate from Drupal to Hugo, needs "html2markdown" installed on the server
<?php
define('DRUPAL_ROOT', __DIR__);
include_once(DRUPAL_ROOT . '/includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$nids = db_query('SELECT DISTINCT(nid) FROM {node}')
->fetchCol();
$nodes = node_load_multiple($nids);
@svx
svx / earchwallpaper.sh
Created November 9, 2018 08:24 — forked from thet/earchwallpaper.sh
World Sunlight Map Wallpaper
#!/bin/bash
#
# Changes the wallpaper hourly and displays a projection of the earth with
# a semi-realistic rendered sunglight mapping.
#
# This script will download hourly the "World Sunlight Map" by die.net.
# You can choose the world_sunlight_wallpaper.jpg picture as background image for your Desktop.
# Gnome recognizes file changes and updates the background accordingly.
#
# See:
@svx
svx / delete-evicted-pods-all-namespaces.sh
Created August 15, 2018 12:45 — forked from psxvoid/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces