Skip to content

Instantly share code, notes, and snippets.

View ivanhercaz's full-sized avatar
🦉
Working to achieve my dreams!

Iván Hernández Cazorla ivanhercaz

🦉
Working to achieve my dreams!
View GitHub Profile
@cyber-murmel
cyber-murmel / NixOS_on_Hetzner_Cloud.md
Last active November 5, 2023 21:14
NixOS on Hetzner Cloud

This is the gist of how to setup a NixOS server on a Hetzner Cloud instance with an admin user, ssh access and configuration management via git.

  1. Create a Hetzner Cloud instance and click to enter it.
  2. Stop the instance (top right corner icon).
  3. Go to ISO Images.
  4. Search for "nixos" and click mount. ISO Images tab of a Hetzner Cloud instance with the NixOS image already mounted
  5. Start the instance again (top right corner icon).
  6. Open the console (top right corner icon).
  7. Get the IP address by executing ip --brief --color address. The address can also be optained from the Hetzner Cloud web interface.
defmodule GithubClient.ApiClientTest do
alias GithubClient.ApiClient
use ExUnit.Case
import Mox
setup :verify_on_exit!
@username "author-guy"
@org_id "1234"
@org_name "flatiron-labs"
@org %{"id" => @org_id, "login" => @org_name}
@bartoszgorka
bartoszgorka / firebase_auth_service.ex
Created July 29, 2018 08:25
Firebase Cloud Messaging Authorization Service in Elixir
defmodule MyProject.Firebase.AuthService do
@moduledoc """
Firebase authorization service.
"""
@one_hour_in_seconds 3600
@oauth_endpoint "https://www.googleapis.com/oauth2/v4/token"
use Tesla, docs: false
@sheljohn
sheljohn / colours-old.py
Last active May 3, 2024 03:59
Print with colors in most shells (Python, standalone)
# Python 2, class
# Author: J.Hadida (jhadida87 at ggooglemail)
class ColorPrinter:
"""
Usage:
cprint = ColorPrinter()
cprint.cfg('c','m','bux').out('Hello','World!')
cprint.rst().out('Bye now...')
@zhuyifei1999
zhuyifei1999 / signbot.py
Last active April 15, 2022 14:53
Commons Signbot code
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# DUAL LICENSED: You are free to choose either or both of below licenses:
#
# 1.
#
# Published by zhuyifei1999 (https://wikitech.wikimedia.org/wiki/User:Zhuyifei1999)
# under the terms of Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)
# https://creativecommons.org/licenses/by-sa/3.0/
@glombard
glombard / combine.py
Created November 24, 2014 00:22
Merging 4 images into one with Python and PIL/Pillow
# Combine multiple images into one.
#
# To install the Pillow module on Mac OS X:
#
# $ xcode-select --install
# $ brew install libtiff libjpeg webp little-cms2
# $ pip install Pillow
#
from __future__ import print_function
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@martin-ueding
martin-ueding / colorcodes.py
Created November 3, 2012 11:04
Python Colorcodes class
class Colorcodes(object):
"""
Provides ANSI terminal color codes which are gathered via the ``tput``
utility. That way, they are portable. If there occurs any error with
``tput``, all codes are initialized as an empty string.
The provides fields are listed below.
Control:
@jmoy
jmoy / wikiwatch.py
Created February 25, 2011 04:56
Get Wikipedia watchlist as an RSS/ATOM feed
"""Get Wikipedia watchlist as an RSS/ATOM feed
(c) Jyotirmoy Bhattacharya, 2007
Usage: wikiwatch <username> <password> [format]
[format] is either 'rss' or 'atom'
"""
import sys
import xml.sax,xml.sax.handler