Skip to content

Instantly share code, notes, and snippets.

(ns switch
(:require [clojure.pprint :as pprint]))
(defn project-clj-map [filename]
(->> (slurp filename)
(read-string)
(drop 1)
(partition 2)
(map vec)
(into {})))
@mjdietzx
mjdietzx / download_image.py
Last active February 16, 2025 04:33
Download image from url and save as file
import io
from PIL import Image # https://pillow.readthedocs.io/en/4.3.x/
import requests # http://docs.python-requests.org/en/master/
# example image url: https://m.media-amazon.com/images/S/aplus-media/vc/6a9569ab-cb8e-46d9-8aea-a7022e58c74a.jpg
def download_image(url, image_file_path):
r = requests.get(url, timeout=4.0)
if r.status_code != requests.codes.ok:
@hiarcs
hiarcs / Markdown语法子集.md
Last active February 8, 2020 05:14
团队项目开发管理流程

项目文档Markdown语法子集

标题及章节

文档标题使用“#”的语法,章节标题使用“##” ~ “####”共三个级别

文本格式

鉴于中文字体问题,仅使用黑体__Bold__和删除线~~Strikethrough~~,不使用斜体。

列表

使用“-”表示列表。

@Ethan-code
Ethan-code / rebase_first_commit.sh
Created October 13, 2017 06:57 — forked from framon/rebase_first_commit.sh
Insert commit as first, allowing rebase of initial commit
# first you need a new empty branch; let's call it `newroot`
git checkout --orphan newroot
git rm -rf .
# then you apply the same steps
git commit --allow-empty -m 'root commit'
git rebase --onto newroot --root master
git branch -d newroot
@thomasjo
thomasjo / update-nvidia-driver.sh
Created September 4, 2017 06:23
Linux kernel post-installation script for re-installing the NVIDIA (CUDA) driver.
#!/bin/bash
set -eu
KERNEL_DRIVER="/lib/modules/$1/kernel/drivers/video/nvidia.ko"
INSTALLER="/usr/src/cuda-toolkit"
# Build new driver if it doesn't exist
if [ -e $KERNEL_DRIVER ] ; then
echo "NVIDIA driver already installed for this kernel" >&2
@mjdietzx
mjdietzx / waya-dl-setup.sh
Last active May 15, 2025 14:38
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
@Ch4s3
Ch4s3 / install-postgres-9.6-centos7.md
Last active January 29, 2025 09:33
steps for installing postgres 9.6 on Centos7 or RHEL

Update the RPM package

rpm -ivh https://yum.postgresql.org/9.6/redhat/rhel-7.3-x86_64/pgdg-centos96-9.6-3.noarch.rpm

Update packages

yum update
@daniellavoie
daniellavoie / logstash-grok-spring-boot.conf
Last active January 29, 2023 08:24
Logstash grok filter for Logback Logger used by Spring Boot applications
input {
file {
path => /tmp/application.log
codec => multiline {
pattern => "^(%{TIMESTAMP_ISO8601})"
negate => true
what => "previous"
}
}
}
@marcowahl
marcowahl / org-structure-as-dirs-and-files.el
Last active December 20, 2019 06:39
org-save-org-structure-as-dir-file-skeleton to save the org structure as dirs and files (marked with tag :file:)
(defun org-interpret-org-as-dir-file-skeleton ()
"Return the outline paths as lists.
Separated in those headlines not tagged 'file' and those tagged with 'file'."
(let (output-files output-dirs)
(org-map-entries
(lambda ()
(let* ((headline (car (cddddr (org-heading-components))))
(headline-path
(reverse
(cons
@mmasashi
mmasashi / creaet_read_only_user.sql
Created November 14, 2016 20:24
Create read-only user on MySQL
CREATE USER r_only_user identified by 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'%' IDENTIFIED BY 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;