Skip to content

Instantly share code, notes, and snippets.

View davidfischer-ch's full-sized avatar

David Fischer davidfischer-ch

View GitHub Profile
@willurd
willurd / web-servers.md
Last active April 28, 2024 21:38
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@ramnathv
ramnathv / gh-pages.md
Created March 28, 2012 15:37
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@davidfischer-ch
davidfischer-ch / sonar_sarif_to_generic.py
Last active January 12, 2024 10:53
sonar_sarif_to_generic.py
"""
Convert SARIF to Generic SonarQube issues import format.
Links:
* https://community.sonarsource.com/t/import-sarif-results-as-security-hotspots/83223
* docs.sonarqube.org/9.8/analyzing-source-code/importing-external-issues/generic-issue-import-format
* https://gist.github.com/davidfischer-ch/cdfede27ac053a8332b2127becc07608
Author: David Fischer <david@fisch3r.net>
@maethor
maethor / debian_upgrade.yml
Created July 18, 2014 14:06
Ansible playbook to update and upgrade Debian hosts
---
- hosts: all
sudo: yes
tasks:
- name: Update packages list
apt: update_cache=yes
when: ansible_os_family == 'Debian'
- name: List packages to upgrade (1/2)
@fabiomontefuscolo
fabiomontefuscolo / models.py
Created January 9, 2012 19:20
Let the Django FileField overwrite files with the same name
# -*- coding: utf-8 -*-
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.db import models
class OverwriteStorage(FileSystemStorage):
'''
Muda o comportamento padrão do Django e o faz sobrescrever arquivos de
mesmo nome que foram carregados pelo usuário ao invés de renomeá-los.
'''
from rest_framework import serializers
class HyperlinkedIdentityField(serializers.HyperlinkedIdentityField):
"""
This is a performance wrapper for HyperlinkedIdentityField.
We save a ton of time by not calling reverse potentially
thousands of times per request.
"""
def __init__(self, *args, **kwargs):
@Wildcarde
Wildcarde / 01_Readme.md
Last active February 7, 2023 21:15
Quick demo embedding a Bokeh chart inside a Flask application

This works in a python 3.6 environment with bokeh and flask installed. To use this you need the following directory structure:

app/
 - templates/
   - hello.html
 - bokeh-slider.py
 - hello.py

After that you need to open two terminals at app/, in the first one you need to run the bokeh server with the command: