Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hugovk's full-sized avatar

Hugo van Kemenade hugovk

View GitHub Profile
@RabaDabaDoba
RabaDabaDoba / ANSI-color-codes.h
Last active April 19, 2024 06:01 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@dsample
dsample / README.md
Last active April 19, 2024 23:16
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
@benjamincharity
benjamincharity / deletebranch.gitconfig
Last active May 10, 2023 14:39
Git alias function to delete local AND remote branch(s). NOTE: If dealing with branches that are not fully merged, the `-d` would need to change to `-D`.
[alias]
deletebranch = "!f() { \
git push origin --delete "$@"; \
git branch -d "$@"; \
}; f"
# usage:
# git deletebranch my-branch
# git deletebranch branch-1 branch-2 branch-3
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@aparrish
aparrish / index.md
Last active May 6, 2023 14:29
Getting credentials for the Mastodon API with Mastodon.py. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/

Getting credentials for the Mastodon API with Mastodon.py, step by step

Making a bot? Making a bot in Python? Making a bot in Python that uses the Mastodon API? If so, chances are you need to get some credentials. Here's how I did it!

(The following tutorial uses Python 2.7, but if you're using Python 3+ everything should work substantially the same.)

Mastodon.py authentication

I just started using it, but it looks like Mastodon.py is a pretty great library for working with the Mastodon API! However, all of the authentication examples use static files to store credentials, which I don't like—I'm afraid I'll accidentally push them to Github. I like to keep my authentication as close to the actual command that runs the program as possible, so usually I pass them on the command line to the script running my bot. To do this, I need to get the appropriate credentials on their own, as separate strings that I can cut and paste.

@zerolab
zerolab / d8_my_advanced_tab.php
Created November 3, 2016 17:18
Drupal 8 move something to the advanced tabs on node forms
<?php
/**
* Implements hook_form_FORM_ID_alter().
*
* Move your field or group of fields to the node form options vertical tabs.
*/
function mymodule_form_node_form_alter(&$form, FormState $form_state, $form_id) {
$form['mygroup'] = [
@MrRio
MrRio / .travis.yml
Last active October 26, 2016 05:53
# Supercharge your Travis builds with yarn
# Commit your lock file locally, and change your travis to this
language: node_js
node_js:
- "4"
install:
- npm -g install yarn
- yarn
cache:
directories:
@juanpabloaj
juanpabloaj / README.md
Last active June 18, 2018 13:02
Total of pip packages downloaded, separated by Python versions

Total of pip packages downloaded separated by Python versions

From June 26, 2016 (python 3.5.2 release) to Aug. 31, 2016.

Python versions from 2.6 to 3.5

downloads_by_versions

Without 2.7

@crittermike
crittermike / drupal_cache_example.md
Last active August 25, 2018 16:09
Cache get/set examples for Drupal 7 and Drupal 8

Drupal 7

Setting the cache

cache_set('cache_key_goes_here', 'cache_data_goes_here', 'cache', time() + 60);

Fetching the cache

$cache = cache_get('cache_key_goes_here');
@tomtaylor
tomtaylor / names.txt
Last active April 28, 2017 16:16
English village names generated by Tensorflow
Allers Bottom
Culack
Swrarby
Fenwall St Eastake
Anbarth
St Ninhope
Thawkanham Water Green
Mige Lane
Up Maling
Firley Dinch