Skip to content

Instantly share code, notes, and snippets.

View sfxworks's full-sized avatar
🎯
Focusing

Samuel Walker sfxworks

🎯
Focusing
View GitHub Profile
@yuuichi-fujioka
yuuichi-fujioka / install package to qcow image.sh
Created April 17, 2014 04:14
install apt-get package to qcow2 image
sudo apt-get install qemu-utils
sudo modprobe nbd
sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file
sudo mkdir /mnt/ubuntu
sudo mount /dev/nbd0p1 /mnt/ubuntu
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
@oneohthree
oneohthree / quick-slugify.sh
Last active February 22, 2024 01:53
Quick bash slugify
echo "$STRING" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
#!/bin/bash
# This is meant to be executed from packer
if [ -z "$PACKER_BUILD_NAME" ] && [ -z "$PACKER_BUILDER_TYPE" ]; then
echo "Do not run by hand, this is run by packer"
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
@low-ghost
low-ghost / client.py
Last active September 8, 2021 11:41
Simple Python to Javascript 2 way unix socket
"""Creates a python socket client that will interact with javascript."""
import socket
socket_path = '/tmp/node-python-sock'
# connect to the unix local socket with a stream type
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
client.connect(socket_path)
# send an initial message (as bytes)
client.send(b'python connected')
# start a loop
@harshavardhana
harshavardhana / nginx-minio-static.md
Last active April 19, 2024 09:33 — forked from koolhead17/gist:4b8dd8d95ec86368634693cf9ad9391c
How to configure static website using Nginx with MinIO ?

How to configure static website using Nginx with MinIO ?

1. Install nginx

2. Install minio

3. Install mc client

4. Create a bucket:

$ mc mb myminio/static
Bucket created successfully ‘myminio/static’.
@tanaikech
tanaikech / submit.md
Last active April 17, 2024 11:55
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@cheethoe
cheethoe / gist:49d9c1d0003e44423e54a060e0b3fbf1
Last active April 14, 2022 21:01
Rook v0.8.0 device/osd removal
# This will use osd.5 as an example
# ceph commands are expected to be run in the rook-toolbox
1) disk fails
2) remove disk from node
3) mark out osd. `ceph osd out osd.5`
4) remove from crush map. `ceph osd crush remove osd.5`
5) delete caps. `ceph auth del osd.5`
6) remove osd. `ceph osd rm osd.5`
7) delete the deployment `kubectl delete deployment -n rook-ceph rook-ceph-osd-id-5`
8) delete osd data dir on node `rm -rf /var/lib/rook/osd5`
@StephenSorriaux
StephenSorriaux / install-kubernetes-archlinux.md
Created October 25, 2018 18:47
Install Kubernetes on bare-metal ArchLinux host

Installing Kubernetes on ArchLinux

Packages

pacman -S curl docker ebtables ethtool wget unzip

Also cfssl is needed but available on AUR, using pacaur

pacaur -S cfssl
@yellowcrescent
yellowcrescent / k8s-coreos-setup.md
Last active December 17, 2018 21:32
CoreOS Kubernetes cluster setup at Digitalocean

Notes on setting up a Kubernetes cluster on CoreOS (stable) with DigitalOcean's platform.

Partially stolen from this guide by kevashcraft

Spin up VMs

  • Spin up 4 VMs with CoreOS Stable. One will be the master, the other 3 will be workers
  • Tag them with k8s:master and k8s:worker respectively, along with a tag for the cluster
  • Droplets can be created via your DO control panel, or by using doctl. Just change the CLUSTER_NAME, CLUSTER_DOMAIN, and SSHKEY_ID values below to match your own, then save the file to cluster_create.sh, chmod +x cluster_create.sh, then run it ./cluster_create.sh. If you don't already have doctl setup, it will probably be easier to just do this from the DO control panel if you only need to do a one-time setup for development.